﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KinectDwa.Parsers.Data;

namespace KinectDwa.Parsers.Helpers
{
    public class HandGestureReader
    {
        // GesturereReader adjustments (don´t dick around with these or you may ruin the gesturedata collected)
        public const int PicWidth = 20;
        public const int PicHeight = 30;



        // Hardcoded gesture data, smooth
        private static short[] rightFistRotated = new short[]
        {
            0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 17, 18, 19, 19, 18, 16, 14, 12, -1, -1, -1, -1, 0, 0, 0, 0, 0, -1, -1, 19, 19, 19, 19, 19, 19, 18, 18, 17, 16, 15, 15, -1, -1, -1, 0, 0, -1, -1, 20, 20, 19, 19, 18, 17, 17, 17, 18, 18, 19, 18, 17, 18, 18, -1, -1, 0, -1, -1, 20, 20, 19, 18, 17, 17, 17, 17, 18, 19, 20, 20, 21, 22, 23, 21, -1, 0, -1, 18, 21, 20, 20, 19, 18, 18, 19, 19, 20, 21, 22, 23, 24, 26, 27, 25, -1, 0, -1, 20, 22, 21, 22, 21, 22, 23, 24, 25, 25, 25, 25, 26, 28, 29, 31, 30, 21, -1, 18, 22, 23, 23, 24, 25, 26, 28, 29, 30, 31, 31, 31, 31, 32, 34, 36, 35, 23, -1, 20, 23, 24, 25, 26, 27, 30, 32, 34, 36, 37, 38, 37, 37, 37, 39, 40, 38, 25, -1, 20, 23, 26, 26, 28, 29, 32, 34, 37, 40, 42, 42, 42, 42, 42, 44, 45, 41, 26, -1, 19, 24, 26, 29, 30, 31, 33, 35, 38, 41, 44, 45, 45, 45, 46, 47, 47, 42, 27, 0, -1, 23, 27, 30, 32, 33, 34, 36, 39, 42, 44, 45, 46, 47, 48, 48, 48, 41, -1, 0, -1, 22, 27, 32, 34, 35, 36, 38, 40, 42, 44, 45, 46, 47, 48, 50, 48, 37, -1, 0, -1, -1, 26, 32, 37, 39, 40, 40, 42, 43, 44, 45, 46, 47, 49, 50, 46, 33, -1, 0, 0, -1, -1, 33, 39, 43, 43, 43, 44, 45, 45, 46, 47, 49, 51, 50, 44, 27, -1, 0, 0, -1, -1, 34, 42, 46, 47, 47, 47, 47, 47, 48, 49, 51, 52, 50, 42, -1, 0, 0, 0, 0, -1, 35, 45, 49, 51, 50, 50, 49, 50, 50, 52, 53, 53, 49, 38, -1, 0, 0, 0, 0, -1, 35, 49, 52, 54, 53, 53, 52, 52, 53, 55, 56, 54, 46, -1, -1, 0, 0, 0, 0, -1, 41, 53, 56, 58, 56, 56, 55, 55, 56, 57, 58, 53, 44, -1, -1, 0, 0, 0, 0, -1, 47, 57, 59, 61, 59, 58, 58, 58, 59, 60, 59, 52, 44, -1, -1, 0, 0, 0, -1, -1, 51, 61, 62, 63, 62, 61, 61, 61, 62, 62, 59, 51, -1, -1, 0, 0, 0, 0, -1, -1, 55, 62, 64, 65, 64, 63, 63, 64, 65, 64, 57, 51, -1, -1, 0, 0, 0, 0, -1, 51, 59, 64, 66, 66, 66, 65, 65, 65, 66, 64, 54, -1, -1, -1, 0, 0, 0, 0, -1, 55, 63, 66, 68, 68, 67, 67, 67, 67, 67, 62, 54, -1, -1, -1, 0, 0, 0, -1, -1, 63, 66, 68, 69, 69, 69, 68, 68, 69, 68, 60, 57, -1, -1, -1, 0, 0, 0, -1, 55, 68, 66, 70, 71, 70, 70, 69, 70, 71, 66, 60, 58, -1, -1, -1, 0, 0, 0, -1, 64, 69, 68, 71, 72, 71, 71, 71, 71, 71, 66, 60, -1, -1, -1, -1, 0, 0, -1, -1, 67, 71, 70, 68, 68, 70, 71, 71, 72, 70, 62, 59, -1, -1, -1, 0, 0, 0, -1, -1, 65, 70, 71, 70, 67, 63, 63, 65, 65, 59, 52, -1, -1, -1, -1, 0, 0, 0, -1, -1, -1, 47, 46, 45, 42, 37, 35, 30, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0
        };

        private static short[] leftFistRotated = new short[]
        {
            0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 12, 14, 16, 18, 19, 19, 18, 17, -1, -1, 0, 0, 0, 0, -1, -1, -1, 15, 15, 16, 17, 18, 18, 19, 19, 19, 19, 19, 19, -1, -1, 0, 0, -1, -1, 18, 18, 17, 18, 19, 18, 18, 17, 17, 17, 18, 19, 19, 20, 20, -1, -1, 0, -1, 21, 23, 22, 21, 20, 20, 19, 18, 17, 17, 17, 17, 18, 19, 20, 20, -1, -1, 0, -1, 25, 27, 26, 24, 23, 22, 21, 20, 19, 19, 18, 18, 19, 20, 20, 21, 18, -1, 0, 21, 30, 31, 29, 28, 26, 25, 25, 25, 25, 24, 23, 22, 21, 22, 21, 22, 20, -1, 0, 23, 35, 36, 34, 32, 31, 31, 31, 31, 30, 29, 28, 26, 25, 24, 23, 23, 22, 18, -1, 25, 38, 40, 39, 37, 37, 37, 38, 37, 36, 34, 32, 30, 27, 26, 25, 24, 23, 20, -1, 26, 41, 45, 44, 42, 42, 42, 42, 42, 40, 37, 34, 32, 29, 28, 26, 26, 23, 20, -1, 27, 42, 47, 47, 46, 45, 45, 45, 44, 41, 38, 35, 33, 31, 30, 29, 26, 24, 19, -1, -1, 41, 48, 48, 48, 47, 46, 45, 44, 42, 39, 36, 34, 33, 32, 30, 27, 23, -1, 0, -1, 37, 48, 50, 48, 47, 46, 45, 44, 42, 40, 38, 36, 35, 34, 32, 27, 22, -1, 0, -1, 33, 46, 50, 49, 47, 46, 45, 44, 43, 42, 40, 40, 39, 37, 32, 26, -1, -1, 0, -1, 27, 44, 50, 51, 49, 47, 46, 45, 45, 44, 43, 43, 43, 39, 33, -1, -1, 0, 0, 0, -1, 42, 50, 52, 51, 49, 48, 47, 47, 47, 47, 47, 46, 42, 34, -1, -1, 0, 0, 0, -1, 38, 49, 53, 53, 52, 50, 50, 49, 50, 50, 51, 49, 45, 35, -1, 0, 0, 0, 0, -1, -1, 46, 54, 56, 55, 53, 52, 52, 53, 53, 54, 52, 49, 35, -1, 0, 0, 0, 0, -1, -1, 44, 53, 58, 57, 56, 55, 55, 56, 56, 58, 56, 53, 41, -1, 0, 0, 0, 0, -1, -1, 44, 52, 59, 60, 59, 58, 58, 58, 59, 61, 59, 57, 47, -1, 0, 0, 0, 0, 0, -1, -1, 51, 59, 62, 62, 61, 61, 61, 62, 63, 62, 61, 51, -1, -1, 0, 0, 0, 0, -1, -1, 51, 57, 64, 65, 64, 63, 63, 64, 65, 64, 62, 55, -1, -1, 0, 0, 0, 0, -1, -1, -1, 54, 64, 66, 65, 65, 65, 66, 66, 66, 64, 59, 51, -1, 0, 0, 0, 0, -1, -1, -1, 54, 62, 67, 67, 67, 67, 67, 68, 68, 66, 63, 55, -1, 0, 0, 0, 0, -1, -1, -1, 57, 60, 68, 69, 68, 68, 69, 69, 69, 68, 66, 63, -1, -1, 0, 0, 0, -1, -1, -1, 58, 60, 66, 71, 70, 69, 70, 70, 71, 70, 66, 68, 55, -1, 0, 0, 0, -1, -1, -1, -1, 60, 66, 71, 71, 71, 71, 71, 72, 71, 68, 69, 64, -1, 0, 0, 0, 0, -1, -1, -1, 59, 62, 70, 72, 71, 71, 70, 68, 68, 70, 71, 67, -1, -1, 0, 0, 0, -1, -1, -1, -1, 52, 59, 65, 65, 63, 63, 67, 70, 71, 70, 65, -1, -1, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, 30, 35, 37, 42, 45, 46, 47, -1, -1, -1
        };

        private static short[] rightBrofistRotated = new short[]
        {
            0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 25, 26, 25, 21, 20, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 30, 34, 34, 33, 32, 28, 24, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 28, 33, 34, 35, 34, 34, 32, 29, 24, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 31, 33, 33, 33, 33, 33, 32, 31, 28, 25, -1, -1, 0, 0, 0, 0, 0, 0, -1, -1, 31, 31, 30, 30, 30, 30, 30, 30, 30, 27, 26, -1, -1, 0, 0, 0, 0, -1, -1, 27, 30, 29, 27, 27, 28, 28, 28, 28, 30, 30, 26, -1, -1, -1, 0, 0, 0, -1, -1, 28, 29, 26, 24, 24, 25, 26, 25, 26, 28, 31, 29, 27, -1, -1, 0, 0, 0, -1, -1, 29, 27, 22, 20, 21, 22, 23, 23, 24, 27, 29, 31, 28, 29, -1, 0, 0, -1, -1, 28, 31, 25, 19, 17, 18, 19, 20, 21, 22, 25, 28, 30, 29, 28, -1, -1, 0, -1, -1, 31, 32, 22, 17, 14, 15, 17, 17, 18, 20, 24, 26, 28, 30, 29, 28, -1, 0, -1, -1, 35, 32, 20, 14, 12, 12, 14, 15, 16, 18, 22, 25, 27, 29, 30, 29, -1, 0, -1, 33, 40, 33, 19, 12, 10, 10, 11, 12, 14, 16, 20, 23, 25, 28, 30, 29, -1, 0, -1, 38, 43, 33, 18, 10, 8, 8, 9, 10, 12, 15, 18, 21, 24, 27, 29, 30, 26, 0, -1, 44, 46, 33, 17, 10, 7, 7, 8, 9, 10, 13, 17, 20, 23, 25, 28, 30, 27, -1, 40, 47, 48, 34, 18, 10, 7, 6, 7, 8, 9, 12, 15, 18, 22, 25, 27, 30, 28, -1, 41, 50, 48, 34, 19, 10, 7, 6, 6, 7, 9, 11, 14, 17, 20, 24, 26, 29, 28, -1, 45, 51, 47, 34, 20, 11, 7, 6, 6, 7, 8, 10, 13, 16, 20, 23, 25, 28, 28, -1, 45, 52, 46, 34, 22, 14, 9, 7, 6, 7, 8, 10, 13, 16, 19, 22, 25, 28, 29, -1, 49, 51, 44, 34, 24, 16, 11, 9, 8, 8, 8, 10, 13, 16, 18, 21, 24, 28, 27, -1, 51, 52, 43, 34, 26, 20, 15, 12, 10, 10, 9, 11, 13, 16, 18, 21, 24, 28, 26, -1, 51, 49, 42, 34, 28, 23, 18, 15, 12, 11, 11, 12, 14, 16, 18, 20, 24, 27, -1, -1, -1, 49, 40, 34, 29, 26, 22, 19, 16, 15, 14, 14, 15, 17, 18, 20, 24, 27, -1, -1, -1, 50, 40, 34, 30, 29, 26, 23, 20, 18, 17, 16, 17, 17, 19, 21, 24, 25, -1, 0, -1, -1, 40, 33, 31, 32, 30, 27, 24, 22, 20, 19, 19, 19, 20, 22, 24, -1, 0, 0, -1, -1, -1, 33, 32, 33, 35, 33, 30, 27, 26, 23, 22, 21, 21, 23, 22, -1, 0, 0, -1, -1, -1, -1, 32, 33, 37, 38, 38, 33, 30, 26, 23, 21, 22, 22, -1, 0, 0, 0, 0, -1, -1, -1, -1, 33, 37, 41, 43, 40, 34, 28, 21, 19, -1, -1, -1, 0, 0, 0, 0, 0, -1, -1, -1, -1, 32, 39, 42, 45, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0
        };

        private static short[] leftBrofistRotated = new short[]
        {
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 20, 21, 25, 26, 25, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 24, 28, 32, 33, 34, 34, 30, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 24, 29, 32, 34, 34, 35, 34, 33, 28, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 25, 28, 31, 32, 33, 33, 33, 33, 33, 31, -1, -1, 0, 0, 0, 0, 0, -1, -1, 26, 27, 30, 30, 30, 30, 30, 30, 30, 31, 31, -1, -1, 0, 0, 0, 0, -1, -1, -1, 26, 30, 30, 28, 28, 28, 28, 27, 27, 29, 30, 27, -1, -1, 0, 0, 0, -1, -1, 27, 29, 31, 28, 26, 25, 26, 25, 24, 24, 26, 29, 28, -1, -1, 0, 0, 0, -1, 29, 28, 31, 29, 27, 24, 23, 23, 22, 21, 20, 22, 27, 29, -1, -1, 0, 0, -1, -1, 28, 29, 30, 28, 25, 22, 21, 20, 19, 18, 17, 19, 25, 31, 28, -1, -1, 0, -1, 28, 29, 30, 28, 26, 24, 20, 18, 17, 17, 15, 14, 17, 22, 32, 31, -1, -1, 0, -1, 29, 30, 29, 27, 25, 22, 18, 16, 15, 14, 12, 12, 14, 20, 32, 35, -1, -1, 0, -1, 29, 30, 28, 25, 23, 20, 16, 14, 12, 11, 10, 10, 12, 19, 33, 40, 33, -1, 0, 26, 30, 29, 27, 24, 21, 18, 15, 12, 10, 9, 8, 8, 10, 18, 33, 43, 38, -1, 0, 27, 30, 28, 25, 23, 20, 17, 13, 10, 9, 8, 7, 7, 10, 17, 33, 46, 44, -1, 0, 28, 30, 27, 25, 22, 18, 15, 12, 9, 8, 7, 6, 7, 10, 18, 34, 48, 47, 40, -1, 28, 29, 26, 24, 20, 17, 14, 11, 9, 7, 6, 6, 7, 10, 19, 34, 48, 50, 41, -1, 28, 28, 25, 23, 20, 16, 13, 10, 8, 7, 6, 6, 7, 11, 20, 34, 47, 51, 45, -1, 29, 28, 25, 22, 19, 16, 13, 10, 8, 7, 6, 7, 9, 14, 22, 34, 46, 52, 45, -1, 27, 28, 24, 21, 18, 16, 13, 10, 8, 8, 8, 9, 11, 16, 24, 34, 44, 51, 49, -1, 26, 28, 24, 21, 18, 16, 13, 11, 9, 10, 10, 12, 15, 20, 26, 34, 43, 52, 51, -1, -1, 27, 24, 20, 18, 16, 14, 12, 11, 11, 12, 15, 18, 23, 28, 34, 42, 49, 51, -1, -1, 27, 24, 20, 18, 17, 15, 14, 14, 15, 16, 19, 22, 26, 29, 34, 40, 49, -1, -1, -1, 25, 24, 21, 19, 17, 17, 16, 17, 18, 20, 23, 26, 29, 30, 34, 40, 50, -1, -1, 0, -1, 24, 22, 20, 19, 19, 19, 20, 22, 24, 27, 30, 32, 31, 33, 40, -1, -1, 0, 0, -1, 22, 23, 21, 21, 22, 23, 26, 27, 30, 33, 35, 33, 32, 33, -1, -1, -1, 0, 0, 0, -1, 22, 22, 21, 23, 26, 30, 33, 38, 38, 37, 33, 32, -1, -1, -1, -1, 0, 0, 0, -1, -1, -1, 19, 21, 28, 34, 40, 43, 41, 37, 33, -1, -1, -1, -1, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, 45, 42, 39, 32, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0
        };

        private static short[] rightDerpFistRotated = new short[]
        {
            0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 22, 23, 23, 25, 26, 24, 20, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 22, 26, 26, 27, 28, 28, 28, 26, 22, 18, -1, -1, 0, 0, 0, 0, 0, 0, -1, 21, 24, 24, 24, 24, 25, 25, 26, 26, 25, 23, 19, -1, -1, -1, 0, 0, 0, -1, -1, 22, 22, 20, 19, 20, 20, 21, 21, 22, 24, 25, 25, 22, 19, -1, -1, 0, 0, -1, 19, 21, 19, 16, 14, 14, 15, 15, 17, 18, 20, 23, 25, 25, 24, 21, -1, -1, 0, -1, 20, 20, 17, 13, 10, 9, 10, 11, 12, 14, 16, 19, 22, 23, 25, 24, 21, -1, 0, -1, 21, 20, 16, 11, 7, 6, 7, 8, 9, 10, 13, 15, 18, 21, 22, 25, 24, 15, 0, -1, 23, 22, 16, 10, 6, 5, 5, 6, 7, 8, 10, 12, 15, 18, 20, 22, 25, 18, 0, -1, 26, 25, 18, 10, 6, 4, 4, 5, 5, 6, 8, 10, 13, 16, 18, 20, 23, 20, 0, -1, 28, 27, 18, 10, 6, 5, 5, 5, 5, 5, 7, 9, 12, 15, 17, 19, 21, 21, 0, -1, 27, 27, 18, 10, 6, 5, 6, 6, 6, 6, 8, 9, 12, 14, 17, 19, 20, 19, 0, 17, 26, 24, 16, 9, 6, 6, 7, 7, 7, 8, 9, 11, 13, 15, 18, 19, 20, 17, 0, 16, 24, 21, 14, 9, 7, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 20, 20, 15, -1, 19, 23, 19, 14, 10, 8, 7, 8, 9, 10, 12, 14, 16, 18, 21, 22, 23, 21, -1, -1, 21, 23, 20, 16, 12, 10, 10, 10, 12, 13, 15, 18, 21, 24, 26, 26, 26, 21, -1, -1, 23, 24, 22, 20, 17, 15, 14, 15, 16, 18, 21, 25, 28, 30, 31, 31, 30, 23, -1, -1, 23, 26, 26, 25, 23, 22, 22, 22, 24, 27, 31, 35, 38, 38, 38, 38, 32, -1, 0, -1, 22, 29, 31, 31, 30, 30, 31, 32, 35, 39, 43, 46, 47, 46, 46, 44, 34, -1, 0, 0, 19, 31, 35, 36, 36, 37, 38, 40, 44, 47, 51, 53, 53, 52, 51, 46, -1, -1, 0, 0, -1, 34, 42, 43, 43, 43, 44, 46, 49, 52, 55, 56, 56, 56, 54, 43, -1, 0, 0, 0, -1, 37, 48, 50, 50, 50, 51, 52, 54, 56, 59, 60, 59, 59, 54, 39, -1, 0, 0, 0, -1, -1, 55, 61, 60, 58, 58, 59, 60, 61, 63, 64, 62, 61, 49, -1, 0, 0, 0, 0, -1, -1, 63, 71, 71, 67, 66, 66, 66, 67, 68, 68, 67, 60, 44, -1, 0, 0, 0, 0, -1, -1, 64, 75, 82, 77, 74, 73, 73, 74, 74, 73, 71, 57, -1, 0, 0, 0, 0, 0, 0, -1, -1, 70, 84, 84, 82, 80, 79, 79, 80, 78, 71, 53, -1, 0, 0, 0, 0, 0, 0, -1, -1, -1, 75, 87, 87, 86, 84, 84, 83, 80, 66, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 64, 79, 89, 90, 88, 87, 85, 74, 59, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 61, 79, 88, 87, 84, 73, 60, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 50, 62, 68, 68, -1, -1, 0, 0, 0, 0, 0, 0, 0
        };

        private static short[] leftDerpFistRotated = new short[]
        {
            0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 20, 24, 26, 25, 23, 23, 22, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 18, 22, 26, 28, 28, 28, 27, 26, 26, 22, -1, -1, 0, 0, 0, 0, -1, -1, -1, 19, 23, 25, 26, 26, 25, 25, 24, 24, 24, 24, 21, -1, 0, 0, 0, -1, -1, 19, 22, 25, 25, 24, 22, 21, 21, 20, 20, 19, 20, 22, 22, -1, -1, 0, -1, -1, 21, 24, 25, 25, 23, 20, 18, 17, 15, 15, 14, 14, 16, 19, 21, 19, -1, 0, -1, 21, 24, 25, 23, 22, 19, 16, 14, 12, 11, 10, 9, 10, 13, 17, 20, 20, -1, 0, 15, 24, 25, 22, 21, 18, 15, 13, 10, 9, 8, 7, 6, 7, 11, 16, 20, 21, -1, 0, 18, 25, 22, 20, 18, 15, 12, 10, 8, 7, 6, 5, 5, 6, 10, 16, 22, 23, -1, 0, 20, 23, 20, 18, 16, 13, 10, 8, 6, 5, 5, 4, 4, 6, 10, 18, 25, 26, -1, 0, 21, 21, 19, 17, 15, 12, 9, 7, 5, 5, 5, 5, 5, 6, 10, 18, 27, 28, -1, 0, 19, 20, 19, 17, 14, 12, 9, 8, 6, 6, 6, 6, 5, 6, 10, 18, 27, 27, -1, 0, 17, 20, 19, 18, 15, 13, 11, 9, 8, 7, 7, 7, 6, 6, 9, 16, 24, 26, 17, 0, 15, 20, 20, 19, 17, 15, 13, 11, 10, 9, 8, 7, 6, 7, 9, 14, 21, 24, 16, 0, -1, 21, 23, 22, 21, 18, 16, 14, 12, 10, 9, 8, 7, 8, 10, 14, 19, 23, 19, -1, -1, 21, 26, 26, 26, 24, 21, 18, 15, 13, 12, 10, 10, 10, 12, 16, 20, 23, 21, -1, -1, 23, 30, 31, 31, 30, 28, 25, 21, 18, 16, 15, 14, 15, 17, 20, 22, 24, 23, -1, 0, -1, 32, 38, 38, 38, 38, 35, 31, 27, 24, 22, 22, 22, 23, 25, 26, 26, 23, -1, 0, -1, 34, 44, 46, 46, 47, 46, 43, 39, 35, 32, 31, 30, 30, 31, 31, 29, 22, -1, 0, -1, -1, 46, 51, 52, 53, 53, 51, 47, 44, 40, 38, 37, 36, 36, 35, 31, 19, 0, 0, 0, -1, 43, 54, 56, 56, 56, 55, 52, 49, 46, 44, 43, 43, 43, 42, 34, -1, 0, 0, 0, -1, 39, 54, 59, 59, 60, 59, 56, 54, 52, 51, 50, 50, 50, 48, 37, -1, 0, 0, 0, 0, -1, 49, 61, 62, 64, 63, 61, 60, 59, 58, 58, 60, 61, 55, -1, -1, 0, 0, 0, 0, -1, 44, 60, 67, 68, 68, 67, 66, 66, 66, 67, 71, 71, 63, -1, -1, 0, 0, 0, 0, 0, -1, 57, 71, 73, 74, 74, 73, 73, 74, 77, 82, 75, 64, -1, -1, 0, 0, 0, 0, 0, -1, 53, 71, 78, 80, 79, 79, 80, 82, 84, 84, 70, -1, -1, 0, 0, 0, 0, 0, 0, -1, -1, 66, 80, 83, 84, 84, 86, 87, 87, 75, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, 59, 74, 85, 87, 88, 90, 89, 79, 64, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 60, 73, 84, 87, 88, 79, 61, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 68, 68, 62, 50, -1, -1, 0, 0, 0, 0, 0
        };

        private static short[] rightHerpFistRotated = new short[]
        {
            0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 19, 19, 17, 18, 20, 22, 18, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 18, 19, 16, 15, 15, 17, 18, 18, 18, 16, -1, -1, 0, 0, 0, 0, 0, 0, -1, -1, 17, 15, 11, 9, 9, 10, 11, 12, 15, 17, 18, 14, -1, -1, 0, 0, 0, 0, -1, -1, 18, 14, 9, 6, 6, 6, 7, 7, 10, 13, 15, 16, 17, 13, -1, 0, 0, 0, -1, -1, 17, 11, 7, 6, 5, 5, 4, 4, 6, 8, 10, 12, 15, 16, 12, 0, 0, 0, -1, -1, 14, 7, 4, 4, 5, 4, 3, 3, 4, 5, 6, 8, 10, 11, 12, 0, 0, 0, -1, 15, 9, 5, 3, 3, 3, 3, 3, 3, 4, 4, 4, 5, 6, 8, 10, 0, 0, -1, 13, 13, 9, 5, 3, 3, 3, 3, 3, 4, 5, 5, 4, 5, 6, 8, 11, 0, 0, -1, 15, 13, 10, 7, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 10, 12, 0, -1, 16, 17, 15, 13, 12, 12, 12, 14, 16, 16, 14, 12, 11, 10, 10, 11, 14, 14, 0, -1, -1, 16, 18, 17, 17, 18, 20, 23, 25, 25, 23, 20, 19, 18, 17, 19, 20, -1, 0, -1, -1, 17, 21, 21, 21, 22, 23, 25, 29, 30, 30, 28, 27, 26, 25, 26, 21, -1, 0, 0, -1, -1, 21, 25, 25, 25, 26, 27, 30, 32, 33, 33, 32, 31, 31, 28, 14, 0, 0, 0, -1, -1, 23, 30, 29, 29, 29, 31, 32, 34, 35, 35, 34, 33, 33, 22, -1, 0, 0, 0, -1, -1, 28, 36, 36, 35, 35, 35, 36, 37, 37, 37, 36, 35, 30, -1, 0, 0, 0, 0, 0, -1, 37, 49, 46, 43, 42, 41, 40, 40, 40, 39, 38, 37, 18, 0, 0, 0, 0, 0, -1, -1, 51, 61, 55, 50, 47, 46, 45, 45, 44, 44, 43, 30, -1, 0, 0, 0, 0, 0, -1, 49, 65, 66, 61, 56, 54, 52, 51, 50, 50, 49, 47, 26, 0, 0, 0, 0, 0, 0, -1, 61, 72, 69, 65, 61, 58, 57, 56, 55, 55, 54, 45, -1, 0, 0, 0, 0, 0, -1, 56, 72, 75, 71, 67, 64, 62, 60, 60, 59, 60, 57, 36, 0, 0, 0, 0, 0, 0, -1, 65, 82, 77, 73, 70, 67, 65, 63, 63, 63, 65, 49, -1, 0, 0, 0, 0, 0, 0, -1, 76, 84, 79, 75, 72, 69, 68, 67, 67, 68, 67, 37, 0, 0, 0, 0, 0, 0, -1, 66, 82, 85, 81, 77, 75, 72, 71, 70, 70, 71, 64, -1, 0, 0, 0, 0, 0, 0, -1, 74, 88, 85, 83, 80, 77, 75, 74, 73, 73, 74, 51, -1, 0, 0, 0, 0, 0, 0, -1, 81, 90, 85, 84, 81, 79, 77, 76, 75, 76, 73, 37, 0, 0, 0, 0, 0, 0, 0, -1, 84, 91, 87, 84, 82, 80, 79, 78, 78, 79, 63, -1, 0, 0, 0, 0, 0, 0, 0, -1, 66, 89, 89, 83, 83, 82, 81, 80, 81, 81, 54, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 43, 71, 84, 82, 83, 82, 82, 83, 80, 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 47, 69, 78, 80, 83, 66, -1, 0, 0, 0, 0, 0, 0, 0, 0
        };

        private static short[] leftHerpFistRotated = new short[]
        {
            0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 18, 22, 20, 18, 17, 19, 19, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 16, 18, 18, 18, 17, 15, 15, 16, 19, 18, -1, 0, 0, 0, 0, 0, -1, -1, 14, 18, 17, 15, 12, 11, 10, 9, 9, 11, 15, 17, -1, -1, 0, 0, 0, -1, 13, 17, 16, 15, 13, 10, 7, 7, 6, 6, 6, 9, 14, 18, -1, -1, 0, 0, 0, 12, 16, 15, 12, 10, 8, 6, 4, 4, 5, 5, 6, 7, 11, 17, -1, -1, 0, 0, 0, 12, 11, 10, 8, 6, 5, 4, 3, 3, 4, 5, 4, 4, 7, 14, -1, -1, 0, 0, 0, 10, 8, 6, 5, 4, 4, 4, 3, 3, 3, 3, 3, 3, 5, 9, 15, -1, 0, 0, 0, 11, 8, 6, 5, 4, 5, 5, 4, 3, 3, 3, 3, 3, 5, 9, 13, 13, -1, 0, 0, 12, 10, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 7, 10, 13, 15, -1, 0, 0, 14, 14, 11, 10, 10, 11, 12, 14, 16, 16, 14, 12, 12, 12, 13, 15, 17, 16, -1, 0, -1, 20, 19, 17, 18, 19, 20, 23, 25, 25, 23, 20, 18, 17, 17, 18, 16, -1, -1, 0, -1, 21, 26, 25, 26, 27, 28, 30, 30, 29, 25, 23, 22, 21, 21, 21, 17, -1, -1, 0, 0, 14, 28, 31, 31, 32, 33, 33, 32, 30, 27, 26, 25, 25, 25, 21, -1, -1, 0, 0, 0, -1, 22, 33, 33, 34, 35, 35, 34, 32, 31, 29, 29, 29, 30, 23, -1, -1, 0, 0, 0, 0, -1, 30, 35, 36, 37, 37, 37, 36, 35, 35, 35, 36, 36, 28, -1, -1, 0, 0, 0, 0, 0, 18, 37, 38, 39, 40, 40, 40, 41, 42, 43, 46, 49, 37, -1, 0, 0, 0, 0, 0, 0, -1, 30, 43, 44, 44, 45, 45, 46, 47, 50, 55, 61, 51, -1, -1, 0, 0, 0, 0, 0, 0, 26, 47, 49, 50, 50, 51, 52, 54, 56, 61, 66, 65, 49, -1, 0, 0, 0, 0, 0, 0, -1, 45, 54, 55, 55, 56, 57, 58, 61, 65, 69, 72, 61, -1, 0, 0, 0, 0, 0, 0, 0, 36, 57, 60, 59, 60, 60, 62, 64, 67, 71, 75, 72, 56, -1, 0, 0, 0, 0, 0, 0, -1, 49, 65, 63, 63, 63, 65, 67, 70, 73, 77, 82, 65, -1, 0, 0, 0, 0, 0, 0, 0, 37, 67, 68, 67, 67, 68, 69, 72, 75, 79, 84, 76, -1, 0, 0, 0, 0, 0, 0, 0, -1, 64, 71, 70, 70, 71, 72, 75, 77, 81, 85, 82, 66, -1, 0, 0, 0, 0, 0, 0, -1, 51, 74, 73, 73, 74, 75, 77, 80, 83, 85, 88, 74, -1, 0, 0, 0, 0, 0, 0, 0, 37, 73, 76, 75, 76, 77, 79, 81, 84, 85, 90, 81, -1, 0, 0, 0, 0, 0, 0, 0, -1, 63, 79, 78, 78, 79, 80, 82, 84, 87, 91, 84, -1, 0, 0, 0, 0, 0, 0, 0, -1, 54, 81, 81, 80, 81, 82, 83, 83, 89, 89, 66, -1, 0, 0, 0, 0, 0, 0, 0, 0, 39, 80, 83, 82, 82, 83, 82, 84, 71, 43, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 66, 83, 80, 78, 69, 47, -1, 0, 0, 0, 0
        };

        private static short[] rightLoserRotated = new short[]
        {
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 19, 17, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 24, 21, 18, 15, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 25, 22, 18, 14, -1, -1, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0, -1, -1, 28, 26, 23, 17, 12, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, 0, 0, -1, -1, -1, 28, 27, 23, 17, 12, -1, -1, -1, 0, 0, 0, 12, 13, -1, -1, -1, 0, -1, -1, 30, 30, 28, 23, 18, 11, 7, -1, -1, -1, 0, -1, 13, 13, 14, -1, -1, -1, -1, -1, 29, 32, 29, 24, 18, 10, 6, 5, -1, -1, -1, -1, 12, 14, 15, 16, -1, -1, -1, -1, 31, 33, 30, 25, 18, 11, 6, 5, 6, -1, -1, 0, -1, 13, 16, 17, 19, -1, -1, 26, 31, 32, 31, 27, 19, 12, 8, 6, 6, -1, -1, 0, -1, -1, 15, 18, 19, 21, 21, 26, 30, 31, 32, 27, 19, 13, 9, 7, 7, 10, -1, 0, 0, -1, -1, 18, 20, 20, 22, 25, 28, 30, 31, 29, 21, 14, 11, 9, 8, 12, -1, 0, 0, 0, -1, 19, 20, 21, 22, 25, 27, 29, 31, 30, 23, 17, 13, 11, 11, 13, 13, 0, 0, 0, -1, -1, 22, 22, 23, 24, 25, 28, 30, 31, 26, 20, 16, 13, 13, 15, 12, 0, 0, 0, 0, -1, 21, 23, 23, 24, 25, 27, 30, 32, 29, 23, 19, 16, 15, 16, 12, 0, 0, 0, 0, -1, -1, 24, 24, 25, 26, 28, 30, 32, 31, 25, 21, 19, 18, 16, -1, 0, 0, 0, 0, 0, -1, -1, 26, 26, 29, 29, 31, 33, 32, 28, 24, 22, 21, 16, -1, 0, 0, 0, 0, 0, -1, -1, 27, 29, 32, 32, 32, 34, 34, 31, 28, 26, 24, 16, -1, 0, 0, 0, 0, 0, 0, -1, 29, 35, 37, 35, 35, 36, 36, 35, 32, 30, 25, -1, 0, 0, 0, 0, 0, 0, 0, -1, 37, 41, 42, 39, 38, 38, 38, 38, 36, 34, 26, -1, 0, 0, 0, 0, 0, 0, 0, -1, 45, 47, 47, 43, 42, 41, 41, 41, 40, 37, -1, -1, 0, 0, 0, 0, 0, 0, -1, -1, 55, 54, 52, 48, 46, 45, 45, 45, 44, 36, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 62, 61, 57, 53, 51, 50, 49, 49, 47, 35, -1, 0, 0, 0, 0, 0, 0, -1, -1, -1, 68, 66, 62, 58, 56, 55, 54, 53, 47, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 67, 72, 70, 67, 63, 61, 59, 59, 56, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 62, 73, 72, 68, 66, 65, 62, 57, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, 55, 65, 66, 68, 63, -1, -1, 0, 0, 0, 0
        };

        private static short[] leftLoserRotated = new short[]
        {
            0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 17, 19, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 15, 18, 21, 24, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 14, 18, 22, 25, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 12, 17, 23, 26, 28, -1, -1, 0, 0, 0, 0, 0, -1, -1, 0, 0, 0, -1, -1, -1, 12, 17, 23, 27, 28, -1, -1, -1, 0, 0, 0, -1, -1, -1, 0, 0, -1, -1, -1, 7, 11, 18, 23, 28, 30, 30, -1, -1, 0, -1, -1, -1, 13, 12, 0, -1, -1, -1, 5, 6, 10, 18, 24, 29, 32, 29, -1, -1, -1, -1, -1, 14, 13, 13, -1, -1, -1, 6, 5, 6, 11, 18, 25, 30, 33, 31, -1, -1, -1, -1, 16, 15, 14, 12, -1, -1, -1, 6, 6, 8, 12, 19, 27, 31, 32, 31, 26, -1, -1, 19, 17, 16, 13, -1, 0, -1, 10, 7, 7, 9, 13, 19, 27, 32, 31, 30, 26, 21, 21, 19, 18, 15, -1, -1, 0, -1, 12, 8, 9, 11, 14, 21, 29, 31, 30, 28, 25, 22, 20, 20, 18, -1, -1, 0, 0, 13, 13, 11, 11, 13, 17, 23, 30, 31, 29, 27, 25, 22, 21, 20, 19, -1, 0, 0, 0, 12, 15, 13, 13, 16, 20, 26, 31, 30, 28, 25, 24, 23, 22, 22, -1, -1, 0, 0, 0, 12, 16, 15, 16, 19, 23, 29, 32, 30, 27, 25, 24, 23, 23, 21, -1, 0, 0, 0, 0, -1, 16, 18, 19, 21, 25, 31, 32, 30, 28, 26, 25, 24, 24, -1, -1, 0, 0, 0, 0, -1, 16, 21, 22, 24, 28, 32, 33, 31, 29, 29, 26, 26, -1, -1, 0, 0, 0, 0, 0, -1, 16, 24, 26, 28, 31, 34, 34, 32, 32, 32, 29, 27, -1, -1, 0, 0, 0, 0, 0, 0, -1, 25, 30, 32, 35, 36, 36, 35, 35, 37, 35, 29, -1, 0, 0, 0, 0, 0, 0, 0, -1, 26, 34, 36, 38, 38, 38, 38, 39, 42, 41, 37, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 37, 40, 41, 41, 41, 42, 43, 47, 47, 45, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 36, 44, 45, 45, 45, 46, 48, 52, 54, 55, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, 35, 47, 49, 49, 50, 51, 53, 57, 61, 62, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 47, 53, 54, 55, 56, 58, 62, 66, 68, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 56, 59, 59, 61, 63, 67, 70, 72, 67, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 57, 62, 65, 66, 68, 72, 73, 62, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 63, 68, 66, 65, 55, -1, -1, -1, -1, -1, 0, 0, 0, 0
        };

        /* original - replaced with the amazing test room version
        private static short[] rightLoserPointRotated = new short[]
        {
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 9, 9, -1, -1, -1, 0, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 12, 13, 12, -1, -1, -1, 0, 0, -1, -1, -1, -1, 0, 0, 0, 0, 0, -1, -1, 16, 16, 17, 15, -1, -1, 0, 0, 0, -1, -1, -1, -1, 0, 0, 0, 0, 0, -1, -1, 21, 22, 21, 18, -1, -1, 0, 0, 0, -1, -1, -1, -1, -1, 0, 0, 0, -1, -1, 24, 26, 25, 23, 20, -1, 0, 0, 0, 0, -1, -1, -1, -1, -1, 0, 0, 0, -1, -1, 28, 31, 28, 26, 26, -1, -1, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 31, 35, 33, 31, 30, 30, 31, -1, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 33, 39, 38, 35, 33, 32, 31, 31, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, 35, 39, 42, 40, 37, 34, 32, 31, 31, 28, -1, 0, 0, -1, -1, -1, 34, -1, -1, -1, 40, 43, 44, 42, 38, 34, 31, 30, 30, 31, -1, 0, 0, -1, -1, -1, -1, 38, 39, 39, 44, 46, 46, 43, 39, 33, 30, 29, 30, 31, 29, -1, 0, -1, -1, -1, -1, 36, 40, 42, 46, 48, 47, 44, 38, 32, 28, 28, 30, 34, 34, -1, 0, -1, -1, -1, -1, 37, 42, 45, 47, 49, 48, 45, 37, 31, 28, 27, 30, 35, 37, 30, 0, -1, -1, -1, -1, 41, 42, 46, 48, 49, 49, 47, 37, 30, 28, 27, 30, 35, 39, 33, 0, -1, -1, -1, -1, 42, 43, 48, 49, 50, 51, 48, 38, 31, 28, 28, 31, 35, 39, 36, 0, -1, -1, -1, -1, 41, 47, 47, 50, 51, 51, 49, 39, 33, 29, 29, 32, 36, 39, 38, 0, 0, -1, -1, -1, -1, 48, 49, 51, 52, 53, 50, 41, 35, 31, 31, 33, 36, 39, 39, 0, 0, 0, -1, -1, -1, 51, 53, 55, 55, 55, 51, 43, 37, 34, 33, 35, 37, 39, 40, 0, 0, 0, -1, -1, -1, 56, 57, 61, 59, 58, 54, 46, 40, 36, 36, 36, 38, 39, -1, 0, 0, 0, 0, -1, -1, 59, 62, 65, 63, 61, 58, 50, 43, 40, 39, 38, 39, 39, -1, 0, 0, 0, 0, -1, -1, -1, 64, 69, 67, 65, 63, 55, 48, 43, 40, 40, 38, -1, -1, 0, 0, 0, 0, -1, -1, -1, 67, 72, 72, 70, 68, 61, 53, 46, 42, 39, -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 70, 73, 75, 74, 73, 67, 58, 48, 45, -1, -1, -1, 0, 0, 0, 0, 0, 0, -1, -1, -1, 75, 80, 78, 77, 71, 62, 51, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, -1, -1, -1, 77, 84, 84, 79, 74, 62, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 84, 86, 83, 79, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 77, 70, -1, -1, -1, -1, -1, 0, 0, 0
        };
         */

        private static short[] rightLoserPointRotated = new short[]
        {
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 28, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 27, 29, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 28, 31, 32, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 31, 32, 31, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 30, 34, 34, 30, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 31, 34, 35, 30, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 31, 36, 37, 31, 22, 18, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 28, 31, 37, 37, 33, 24, 19, 18, 17, -1, -1, 0, 0, -1, -1, -1, 0, -1, -1, -1, 30, 35, 38, 37, 33, 26, 20, 19, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 26, 32, 37, 38, 37, 33, 27, 22, 20, 20, 19, -1, -1, -1, 14, 16, 17, -1, -1, -1, 27, 33, 37, 38, 37, 33, 28, 23, 22, 21, 21, 19, -1, -1, 15, 18, 20, 21, 21, 24, 28, 33, 36, 37, 37, 35, 30, 26, 24, 24, 24, 23, 18, 0, -1, 17, 19, 22, 22, 24, 28, 32, 35, 37, 37, 36, 33, 30, 28, 27, 28, 27, 18, 0, -1, -1, 18, 21, 23, 25, 27, 30, 33, 36, 38, 38, 37, 34, 31, 30, 31, 30, 22, 0, 0, -1, -1, 19, 22, 25, 27, 29, 32, 35, 37, 39, 39, 37, 35, 34, 35, 32, 23, 0, 0, 0, -1, -1, 20, 23, 26, 29, 31, 34, 37, 40, 41, 40, 38, 38, 38, 33, 21, 0, 0, 0, 0, -1, -1, 23, 25, 29, 32, 34, 37, 40, 41, 42, 41, 42, 41, 33, -1, 0, 0, 0, 0, 0, -1, 22, 26, 29, 33, 35, 37, 40, 42, 43, 44, 45, 43, 32, -1, 0, 0, 0, 0, 0, -1, -1, 26, 29, 35, 37, 39, 41, 43, 45, 46, 48, 44, -1, -1, 0, 0, 0, 0, 0, 0, -1, -1, 33, 38, 41, 42, 43, 45, 47, 49, 50, 41, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 37, 42, 46, 46, 47, 48, 50, 52, 50, 41, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 44, 50, 51, 50, 51, 52, 55, 56, 52, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 51, 57, 57, 56, 56, 58, 59, 60, 51, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 50, 58, 63, 62, 61, 62, 63, 64, 62, 52, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 55, 64, 68, 67, 66, 67, 68, 68, 64, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 61, 68, 72, 71, 71, 71, 71, 71, 67, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 60, 73, 75, 75, 75, 75, 74, 73, 67, -1, -1, 0, 0, 0, 0, 0, 0, -1, -1, -1, 64, 66, 68, 75, 78, 78, 76, 71, 66, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 53, 52, 48, 50, 51, 56, -1, -1, -1, 0, 0
        };

        /*
         * Rotated from right version, not optimal idea
        private static short[] leftLoserPointRotated = new short[]
        {
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 9, 9, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, -1, -1, -1, 12, 13, 12, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 0, -1, -1, 15, 17, 16, 16, -1, -1, 0, 0, 0, 0, 0, -1, -1, -1, -1, 0, 0, 0, -1, -1, 18, 21, 22, 21, -1, -1, 0, 0, 0, 0, 0, -1, -1, -1, -1, 0, 0, 0, 0, -1, 20, 23, 25, 26, 24, -1, -1, 0, 0, 0, -1, -1, -1, -1, -1, 0, 0, 0, -1, -1, 26, 26, 28, 31, 28, -1, -1, 0, 0, 0, -1, -1, -1, -1, -1, 0, 0, 0, -1, 31, 30, 30, 31, 33, 35, 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, -1, 31, 31, 32, 33, 35, 38, 39, 33, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 28, 31, 31, 32, 34, 37, 40, 42, 39, 35, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 31, 30, 30, 31, 34, 38, 42, 44, 43, 40, -1, -1, -1, 34, -1, -1, -1, 0, -1, 29, 31, 30, 29, 30, 33, 39, 43, 46, 46, 44, 39, 39, 38, -1, -1, -1, -1, 0, -1, 34, 34, 30, 28, 28, 32, 38, 44, 47, 48, 46, 42, 40, 36, -1, -1, -1, -1, 0, 30, 37, 35, 30, 27, 28, 31, 37, 45, 48, 49, 47, 45, 42, 37, -1, -1, -1, -1, 0, 33, 39, 35, 30, 27, 28, 30, 37, 47, 49, 49, 48, 46, 42, 41, -1, -1, -1, -1, 0, 36, 39, 35, 31, 28, 28, 31, 38, 48, 51, 50, 49, 48, 43, 42, -1, -1, -1, -1, 0, 38, 39, 36, 32, 29, 29, 33, 39, 49, 51, 51, 50, 47, 47, 41, -1, -1, -1, -1, 0, 39, 39, 36, 33, 31, 31, 35, 41, 50, 53, 52, 51, 49, 48, -1, -1, -1, -1, 0, 0, 40, 39, 37, 35, 33, 34, 37, 43, 51, 55, 55, 55, 53, 51, -1, -1, -1, 0, 0, 0, -1, 39, 38, 36, 36, 36, 40, 46, 54, 58, 59, 61, 57, 56, -1, -1, -1, 0, 0, 0, -1, 39, 39, 38, 39, 40, 43, 50, 58, 61, 63, 65, 62, 59, -1, -1, 0, 0, 0, 0, -1, -1, 38, 40, 40, 43, 48, 55, 63, 65, 67, 69, 64, -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 39, 42, 46, 53, 61, 68, 70, 72, 72, 67, -1, -1, -1, 0, 0, 0, 0, 0, -1, -1, -1, 45, 48, 58, 67, 73, 74, 75, 73, 70, -1, -1, -1, 0, 0, 0, 0, 0, -1, -1, -1, -1, 51, 62, 71, 77, 78, 80, 75, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 62, 74, 79, 84, 84, 77, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, 79, 83, 86, 84, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, 70, 77, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0
        };
         */
        private static short[] leftLoserPointRotated = new short[]
        {
            0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 31, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 35, 33, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 34, 35, 34, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 27, 34, 37, 35, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 23, 32, 38, 38, 34, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 17, 23, 29, 35, 40, 35, -1, -1, 0, 0, 0, -1, -1, 0, 0, 0, 0, -1, -1, 14, 16, 21, 28, 34, 40, 37, 30, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, 11, 14, 17, 21, 27, 34, 39, 40, 34, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, 13, 14, 16, 19, 22, 27, 33, 38, 40, 34, 25, -1, -1, 13, 13, 12, -1, 0, 15, 16, 16, 17, 18, 21, 24, 29, 33, 36, 37, 32, 24, 18, 16, 16, 14, -1, -1, -1, 20, 20, 19, 20, 21, 24, 28, 32, 33, 33, 32, 28, 23, 20, 18, 16, 14, -1, -1, -1, 24, 24, 23, 23, 25, 28, 32, 34, 32, 30, 27, 25, 22, 21, 20, 16, -1, -1, 0, -1, 27, 28, 27, 27, 29, 31, 34, 33, 30, 27, 25, 24, 23, 22, 20, -1, -1, 0, 0, -1, 29, 31, 30, 31, 32, 34, 34, 32, 28, 26, 25, 25, 25, 23, -1, -1, 0, 0, 0, -1, 28, 32, 32, 33, 34, 34, 33, 30, 28, 27, 27, 27, 25, 23, -1, 0, 0, 0, 0, 0, 26, 33, 34, 34, 34, 34, 33, 31, 30, 30, 30, 29, 27, -1, -1, 0, 0, 0, 0, 0, 22, 33, 35, 35, 35, 34, 34, 33, 33, 34, 32, 31, -1, -1, 0, 0, 0, 0, 0, 0, -1, 31, 36, 37, 36, 36, 35, 36, 37, 38, 35, 36, -1, -1, 0, 0, 0, 0, 0, 0, -1, 32, 36, 39, 38, 38, 38, 40, 42, 44, 41, 40, -1, -1, -1, 0, 0, 0, 0, 0, -1, -1, 38, 40, 41, 42, 43, 44, 47, 49, 47, 46, -1, -1, -1, 0, 0, 0, 0, 0, 0, -1, 40, 43, 44, 46, 47, 49, 52, 54, 52, 50, -1, -1, -1, -1, 0, 0, 0, 0, 0, -1, 43, 47, 48, 49, 50, 52, 55, 58, 56, 56, -1, -1, -1, -1, -1, 0, 0, 0, 0, -1, -1, 53, 51, 51, 54, 56, 59, 61, 60, 62, 59, -1, -1, -1, -1, -1, 0, 0, 0, -1, -1, 54, 57, 56, 56, 59, 62, 65, 66, 65, 64, -1, -1, -1, -1, -1, 0, 0, 0, -1, -1, -1, 60, 61, 61, 60, 64, 69, 70, 70, 70, -1, -1, -1, -1, -1, 0, 0, 0, -1, -1, -1, 60, 64, 65, 66, 66, 72, 73, 73, 72, -1, -1, -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 62, 65, 69, 71, 74, 74, 73, 70, -1, -1, -1, -1, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, 59, 58, 56, 59, 68, -1, -1, -1, -1, 0, 0, 0
        };

        private static short[] rightLoser = new short[]
        {
            0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 29, 33, 29, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 34, 36, 32, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 28, 36, 38, 35, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 30, 37, 39, 37, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 32, 38, 41, 39, 36, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, -1, 33, 39, 42, 40, 35, 28, 23, 21, 20, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, -1, 31, 40, 42, 41, 37, 30, 25, 23, 21, 21, 20, 21, -1, -1, 0, 0, 0, 0, 0, -1, 34, 40, 42, 41, 37, 32, 27, 25, 23, 22, 22, 22, 25, -1, 0, 0, -1, -1, -1, -1, 33, 39, 41, 41, 38, 34, 30, 27, 26, 25, 25, 26, 28, 26, -1, -1, -1, -1, -1, -1, 33, 38, 40, 40, 38, 36, 33, 30, 29, 28, 28, 29, 31, 31, -1, -1, -1, -1, 22, 28, 33, 37, 38, 39, 38, 38, 36, 34, 32, 32, 31, 32, 34, 34, -1, 13, 15, 18, 22, 27, 32, 34, 36, 37, 38, 39, 38, 37, 37, 36, 35, 37, 38, 38, -1, -1, 16, 18, 21, 26, 29, 31, 33, 34, 36, 38, 39, 39, 39, 39, 39, 41, 42, 40, 0, -1, -1, 18, 21, 23, 26, 28, 30, 31, 34, 36, 38, 39, 40, 41, 41, 43, 44, 42, 0, 0, -1, -1, 20, 22, 24, 26, 28, 30, 33, 34, 37, 39, 40, 41, 42, 45, 46, 45, 0, 0, 0, -1, -1, -1, 23, 25, 27, 29, 32, 34, 36, 38, 40, 41, 43, 46, 46, 44, 0, 0, 0, 0, 0, -1, -1, 25, 27, 30, 32, 34, 36, 38, 40, 42, 44, 46, 47, 43, 0, 0, 0, 0, 0, 0, -1, -1, 28, 30, 34, 37, 38, 40, 41, 43, 45, 48, 48, 45, 0, 0, 0, 0, 0, 0, 0, -1, -1, 32, 38, 40, 41, 42, 43, 45, 48, 51, 50, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 37, 43, 44, 45, 45, 46, 48, 51, 54, 53, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 43, 49, 50, 50, 49, 50, 52, 55, 57, 55, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 50, 55, 55, 54, 54, 54, 57, 59, 61, 57, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 57, 61, 60, 59, 59, 59, 62, 64, 64, 58, -1, 0, 0, 0, 0, 0, 0, 0, -1, 63, 64, 67, 66, 64, 64, 64, 66, 68, 66, -1, -1, 0, 0, 0, 0, 0, 0, -1, -1, 68, 71, 72, 71, 69, 69, 69, 71, 72, 68, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 75, 75, 77, 75, 74, 74, 74, 75, 76, 72, -1, 0, 0, 0, 0, 0, 0, 0, -1, 75, 80, 80, 81, 79, 79, 77, 77, 79, 79, 73, -1, 0, 0, 0, 0, 0, 0, -1, -1, 75, 78, 80, 84, 84, 83, 81, 82, 83, 81, 72, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 65, 73, 78, 81, 81, 79, 74, 66, -1, -1, 0
        };

        private static short[] leftLoser = new short[]
        {
            0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 30, 29, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 33, 33, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 34, 35, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 23, 35, 37, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 25, 36, 38, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, 25, 36, 40, 39, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, 13, 17, 25, 36, 42, 40, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 11, 11, 13, 18, 27, 36, 42, 40, -1, 0, 0, 0, 0, 0, 0, 0, -1, 14, 12, 11, 12, 13, 15, 20, 27, 36, 42, 41, -1, 0, 0, 0, 0, 0, 0, -1, 16, 15, 14, 13, 13, 15, 17, 22, 29, 36, 42, 42, -1, -1, -1, -1, -1, -1, -1, -1, 17, 17, 16, 16, 16, 18, 20, 25, 30, 36, 41, 41, 36, -1, -1, -1, -1, -1, -1, -1, 19, 20, 19, 19, 20, 21, 24, 28, 31, 35, 39, 39, 36, 31, 32, 31, 32, 32, 32, -1, 21, 22, 23, 23, 23, 25, 26, 29, 31, 34, 36, 36, 34, 32, 32, 31, 33, 32, -1, -1, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 34, 35, 34, 33, 31, 31, 31, -1, -1, -1, 23, 24, 25, 27, 28, 29, 29, 30, 31, 32, 33, 33, 33, 33, 32, -1, -1, -1, -1, -1, 24, 25, 26, 27, 28, 30, 30, 31, 32, 32, 32, 32, 31, 29, -1, -1, -1, 0, 0, -1, 26, 27, 27, 28, 29, 30, 31, 33, 34, 34, 32, 32, 28, -1, -1, -1, 0, 0, 0, -1, 27, 29, 29, 30, 31, 32, 34, 36, 38, 37, 33, -1, -1, -1, 0, 0, 0, 0, 0, 0, 27, 32, 32, 33, 34, 35, 38, 41, 43, 42, 33, -1, -1, 0, 0, 0, 0, 0, 0, 0, 26, 35, 36, 36, 37, 39, 42, 46, 49, 51, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 26, 38, 39, 40, 41, 43, 46, 51, 56, 59, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 40, 43, 44, 45, 46, 50, 56, 61, 65, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 42, 46, 47, 49, 51, 54, 61, 65, 69, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 45, 49, 51, 53, 55, 59, 65, 69, 73, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 46, 52, 56, 57, 59, 63, 69, 72, 76, 73, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 48, 55, 59, 61, 64, 67, 72, 76, 80, 76, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 57, 60, 64, 67, 71, 75, 78, 83, 79, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 60, 65, 68, 73, 78, 81, 84, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 58, 68, 74, 79, 84, -1, -1, 0, 0, 0, 0, 0, 0, 0
        };

        /* updated in the test class
        private static short[] rightLoser = new short[]
        {
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 7, 5, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 10, 9, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 14, 13, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 17, 17, 15, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 20, 20, 19, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 22, 23, 23, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 25, 25, 20, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 27, 27, 22, 17, 13, 13, 14, 16, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 29, 28, 24, 19, 15, 13, 14, 16, 19, 20, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 31, 30, 25, 20, 15, 13, 12, 15, 18, 21, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, 32, 33, 28, 22, 16, 12, 12, 13, 16, 20, 21, -1, 0, 0, 0, 0, 0, 0, 0, 0, 33, 36, 31, 25, 18, 14, 12, 13, 16, 19, 21, -1, -1, 0, 0, 0, 0, 0, 0, 0, 34, 38, 35, 30, 23, 17, 15, 15, 17, 20, 22, -1, -1, 0, 0, 0, 0, 0, 0, 0, 34, 38, 37, 35, 29, 24, 20, 18, 20, 22, 25, -1, -1, 0, -1, -1, -1, -1, -1, -1, 32, 38, 38, 37, 34, 31, 27, 24, 24, 26, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, 36, 37, 37, 36, 34, 32, 30, 29, 30, 31, 31, -1, -1, 24, 25, 26, 28, 29, 30, 32, 35, 35, 36, 37, 36, 35, 34, 33, 34, 36, 35, -1, -1, 25, 25, 26, 28, 30, 31, 31, 34, 34, 35, 36, 37, 38, 37, 36, 37, 41, 40, -1, -1, -1, -1, -1, 28, 30, 31, 33, 34, 35, 36, 37, 39, 40, 40, 40, 41, 45, 47, -1, 0, -1, -1, -1, -1, -1, 31, 34, 35, 36, 37, 39, 41, 42, 43, 44, 45, 49, 56, -1, 0, -1, -1, -1, -1, -1, -1, -1, 34, 37, 38, 41, 44, 45, 47, 48, 50, 54, 61, 60, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, 37, 40, 48, 50, 51, 53, 55, 59, 65, 69, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 50, 56, 57, 58, 60, 63, 69, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 55, 60, 63, 64, 65, 68, 72, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 66, 70, 71, 72, 73, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 75, 75, 78, 78, 79, 70, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 79, 84, 85, 78, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 80, 81, 75, -1, -1
        };

        private static short[] leftLoser = new short[]
        {
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 5, 7, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 9, 10, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 13, 14, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 15, 17, 17, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 19, 20, 20, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 23, 23, 22, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, 20, 25, 25, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 16, 14, 13, 13, 17, 22, 27, 27, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 20, 19, 16, 14, 13, 15, 19, 24, 28, 29, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 21, 18, 15, 12, 13, 15, 20, 25, 30, 31, -1, 0, 0, 0, 0, 0, 0, 0, -1, 21, 20, 16, 13, 12, 12, 16, 22, 28, 33, 32, -1, 0, 0, 0, 0, 0, 0, -1, -1, 21, 19, 16, 13, 12, 14, 18, 25, 31, 36, 33, 0, 0, 0, 0, 0, 0, 0, -1, -1, 22, 20, 17, 15, 15, 17, 23, 30, 35, 38, 34, 0, 0, 0, 0, 0, 0, 0, -1, -1, 25, 22, 20, 18, 20, 24, 29, 35, 37, 38, 34, 0, 0, 0, 0, 0, 0, 0, -1, -1, 28, 26, 24, 24, 27, 31, 34, 37, 38, 38, 32, -1, -1, -1, -1, -1, -1, 0, -1, 31, 31, 30, 29, 30, 32, 34, 36, 37, 37, 36, 32, -1, -1, -1, -1, -1, -1, -1, -1, 35, 36, 34, 33, 34, 35, 36, 37, 36, 35, 35, 32, 30, 29, 28, 26, 25, 24, -1, -1, 40, 41, 37, 36, 37, 38, 37, 36, 35, 34, 34, 31, 31, 30, 28, 26, 25, 25, -1, -1, 47, 45, 41, 40, 40, 40, 39, 37, 36, 35, 34, 33, 31, 30, 28, -1, -1, -1, -1, -1, 56, 49, 45, 44, 43, 42, 41, 39, 37, 36, 35, 34, 31, -1, -1, -1, -1, -1, 0, 60, 61, 54, 50, 48, 47, 45, 44, 41, 38, 37, 34, -1, -1, -1, -1, -1, -1, -1, 0, 69, 65, 59, 55, 53, 51, 50, 48, 40, 37, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 75, 69, 63, 60, 58, 57, 56, 50, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 71, 72, 68, 65, 64, 63, 60, 55, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 76, 73, 72, 71, 70, 66, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 70, 79, 78, 78, 75, 75, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 78, 85, 84, 79, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 75, 81, 80, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
        };
         */


        /*
        // Hardcoded gesture data, smooth
        private static short[] rightFist = new short[]
                    {
                        0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 10, 9, 9, 8, 8, 9, 10, 11, 12, 12, -1, -1, -1, 0, 0, 0, -1, -1, 12, 12, 11, 10, 9, 8, 8, 8, 9, 11, 12, 13, -1, -1, -1, 0, 0, 0, 14, 15, 14, 12, 11, 9, 8, 7, 7, 7, 8, 11, 14, 16, 16, -1, -1, 0, 0, -1, 18, 16, 13, 10, 8, 7, 6, 6, 6, 7, 9, 12, 15, 18, 19, -1, -1, -1, 0, -1, 22, 17, 11, 8, 6, 5, 5, 6, 7, 9, 11, 14, 17, 20, 21, 23, -1, -1, 0, -1, 24, 17, 10, 6, 5, 5, 6, 8, 10, 12, 14, 17, 20, 23, 24, 25, -1, -1, 0, -1, 25, 19, 11, 7, 7, 9, 11, 13, 16, 18, 20, 22, 24, 26, 27, 28, -1, -1, -1, -1, 25, 20, 13, 10, 11, 14, 17, 20, 24, 26, 27, 27, 28, 29, 29, 30, -1, -1, -1, 0, 21, 20, 14, 13, 14, 17, 20, 24, 28, 30, 30, 30, 30, 30, 30, 30, 31, -1, -1, 0, 17, 18, 16, 15, 16, 17, 20, 23, 26, 29, 30, 30, 30, 30, 31, 30, 31, -1, -1, 0, -1, 17, 17, 16, 16, 17, 19, 21, 24, 26, 27, 28, 29, 30, 31, 31, 31, -1, -1, 0, -1, 18, 18, 18, 18, 18, 19, 21, 23, 25, 26, 27, 28, 30, 31, 32, 32, -1, -1, 0, -1, -1, 20, 20, 20, 20, 21, 22, 24, 25, 27, 28, 29, 30, 32, 34, 34, -1, -1, 0, 0, -1, 19, 21, 23, 23, 24, 25, 26, 27, 28, 29, 31, 32, 34, 37, 37, 37, -1, 0, 0, 0, -1, -1, 25, 27, 28, 29, 29, 30, 31, 32, 33, 35, 37, 40, 41, 41, -1, 0, 0, 0, 0, 0, -1, 27, 31, 34, 34, 34, 35, 36, 37, 38, 40, 43, 45, 44, -1, 0, 0, 0, 0, 0, 0, -1, 31, 38, 40, 40, 40, 40, 41, 42, 44, 47, 50, 48, -1, 0, 0, 0, 0, 0, 0, 0, -1, 44, 48, 47, 45, 44, 44, 45, 47, 50, 54, 55, -1, 0, 0, 0, 0, 0, 0, 0, -1, 51, 54, 53, 50, 49, 49, 49, 51, 54, 58, 59, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 59, 59, 55, 54, 53, 53, 55, 57, 61, 63, 53, 0, 0, 0, 0, 0, 0, 0, -1, -1, 64, 63, 61, 58, 57, 57, 58, 60, 63, 67, 58, 0, 0, 0, 0, 0, 0, 0, -1, -1, 67, 67, 66, 63, 62, 61, 61, 63, 66, 70, 62, 0, 0, 0, 0, 0, 0, 0, -1, -1, 71, 71, 70, 67, 66, 65, 64, 65, 68, 72, 68, 0, 0, 0, 0, 0, 0, 0, -1, -1, 75, 74, 74, 72, 69, 68, 67, 68, 69, 73, 73, 0, 0, 0, 0, 0, 0, 0, -1, -1, 77, 77, 77, 75, 73, 71, 70, 70, 71, 75, 73, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 81, 78, 79, 76, 74, 73, 72, 73, 74, 68, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 84, 82, 81, 79, 77, 75, 74, 71, 71, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 85, 83, 84, 82, 79, 74, 68, 69, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 87, 86, 87, 80, 69, -1, -1, -1, 0, 0
                    };

        private static short[] rightPoint = new short[]
                    {
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 4, 8, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 9, 10, 12, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 11, 13, 15, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 14, 16, 19, 21, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 20, 22, 25, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 23, 26, 28, 29, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 24, 29, 31, 32, -1, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 25, 31, 33, 34, 32, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 32, 36, 36, 36, 27, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 34, 37, 38, 38, 31, 23, 21, 22, 22, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, -1, -1, 38, 40, 38, 32, 25, 20, 21, 24, 26, 28, 29, -1, -1, -1, 0, 0, 0, 0, -1, -1, 39, 41, 38, 30, 23, 18, 19, 22, 25, 29, 32, 31, -1, -1, -1, 0, 0, 0, -1, -1, 39, 41, 38, 29, 21, 16, 16, 19, 23, 28, 31, 33, 31, -1, -1, 0, 0, 0, 0, -1, -1, 41, 38, 29, 19, 15, 15, 17, 21, 25, 29, 32, 33, 32, -1, -1, 0, 0, 0, -1, -1, 40, 38, 29, 19, 15, 15, 16, 19, 23, 26, 30, 34, 35, 36, -1, 0, 0, 0, -1, -1, 41, 38, 30, 20, 15, 15, 16, 19, 21, 25, 29, 33, 36, 37, -1, 0, 0, 0, -1, -1, 41, 35, 31, 21, 17, 16, 17, 19, 21, 25, 28, 32, 36, 39, 39, 0, 0, 0, -1, -1, 41, 35, 31, 23, 18, 18, 19, 20, 22, 25, 29, 32, 37, 40, 42, 0, 0, 0, 0, -1, -1, 35, 30, 24, 21, 21, 21, 22, 24, 27, 30, 33, 38, 42, 43, 0, 0, 0, 0, -1, -1, 34, 30, 25, 24, 24, 24, 25, 26, 29, 32, 35, 40, 45, 46, 0, 0, 0, 0, -1, -1, 31, 29, 27, 27, 28, 28, 29, 30, 32, 35, 38, 43, 48, 49, 0, 0, 0, 0, 0, -1, 31, 30, 31, 31, 32, 33, 34, 34, 36, 39, 42, 46, 52, 52, 0, 0, 0, 0, 0, -1, -1, 31, 34, 36, 38, 39, 40, 40, 42, 44, 47, 51, 56, 58, 0, 0, 0, 0, 0, -1, -1, 34, 38, 41, 44, 45, 46, 47, 48, 50, 52, 56, 61, 65, 0, 0, 0, 0, 0, -1, -1, 40, 42, 45, 50, 52, 54, 54, 55, 57, 59, 62, 66, 72, 0, 0, 0, 0, 0, 0, -1, -1, 48, 52, 56, 59, 62, 63, 64, 65, 67, 68, 71, 78, 0, 0, 0, 0, 0, 0, -1, -1, -1, 57, 61, 64, 68, 71, 73, 74, 74, 75, 78, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 66, 68, 73, 78, 81, 82, 81, 80, 79, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 70, 73, 81, 86, 84, 81, 76, -1, 0
                    };

        private static short[] rightJazzHand = new short[]
                    {
                        0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 13, 12, -1, 0, 0, -1, 12, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 13, 13, -1, 0, 0, -1, 13, 12, 0, 0, 0, 0, 0, 0, 0, -1, 19, -1, 0, -1, 14, 15, -1, 0, 0, -1, 13, 12, 0, 0, 0, 0, 0, 0, 0, 21, 23, -1, 0, 0, 15, 18, 15, 0, 0, -1, 14, 13, 0, 0, 0, 0, 0, 0, 0, 23, 23, 21, 0, 0, 18, 21, 19, 0, 0, 14, 16, 14, 0, -1, -1, 0, 0, 0, 0, -1, 24, 24, -1, 0, 19, 24, 24, -1, 0, 17, 18, 16, 0, -1, 12, 0, 0, 0, 0, -1, 24, 26, 22, -1, 21, 26, 28, -1, -1, 20, 21, 19, -1, 11, 13, 0, 0, 0, 0, 0, 25, 27, 27, -1, 23, 28, 30, -1, -1, 22, 23, 21, -1, 15, 16, 0, 0, 0, 0, 0, -1, 28, 29, 26, 26, 30, 31, 29, 23, 24, 25, 23, -1, 19, 19, 0, 0, 0, 0, 0, -1, 28, 30, 31, 29, 31, 32, 32, 26, 26, 27, 26, 22, 23, 20, 0, 0, 0, 0, 0, 0, 27, 31, 32, 31, 32, 32, 32, 28, 27, 28, 26, 24, 25, 19, 0, 0, 0, 0, 0, 0, -1, 31, 33, 33, 32, 32, 31, 29, 27, 28, 27, 25, 26, -1, 0, 0, 0, 0, 0, 0, -1, 31, 33, 32, 32, 31, 30, 28, 26, 26, 25, 25, 25, -1, 0, 0, 0, 0, 0, 0, 0, 29, 34, 32, 31, 31, 30, 28, 26, 24, 23, 24, 23, 0, 0, 0, 0, 0, 0, 0, 0, 26, 34, 33, 33, 32, 31, 29, 26, 23, 22, 23, -1, 0, 0, -1, -1, -1, 0, 0, 0, -1, 35, 35, 35, 35, 34, 31, 27, 23, 21, 22, -1, 0, 0, -1, -1, -1, -1, 0, -1, -1, 36, 37, 37, 37, 36, 33, 29, 25, 22, 23, -1, 0, -1, 24, 23, 24, -1, -1, -1, 30, 37, 38, 39, 39, 39, 35, 31, 27, 24, 24, -1, 0, -1, 27, 26, 26, 27, 27, -1, 31, 36, 38, 39, 41, 41, 38, 33, 29, 27, 25, -1, 0, 0, -1, 27, 28, 29, 32, 31, 33, 36, 37, 39, 41, 42, 40, 35, 31, 29, 28, -1, 0, 0, -1, -1, 29, 31, 32, 33, 34, 34, 35, 38, 41, 42, 41, 37, 33, 31, 30, -1, 0, 0, 0, -1, -1, -1, 33, 34, 34, 34, 35, 37, 40, 42, 42, 38, 35, 33, 32, -1, 0, 0, 0, 0, 0, -1, -1, 34, 35, 35, 35, 37, 40, 42, 42, 39, 36, 35, 36, -1, 0, 0, 0, 0, 0, 0, -1, -1, 36, 37, 38, 39, 41, 43, 43, 41, 38, 37, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 40, 41, 42, 44, 45, 45, 44, 42, 41, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 47, 47, 48, 48, 49, 50, 49, 47, 47, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 52, 54, 55, 56, 56, 56, 55, 58, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 64, 63, 64, 64, 65, 64, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 73, 73, 72, 65, -1, -1, 0, 0, 0
                    };

        private static short[] leftFist = new short[]
                    {
                        0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 12, 12, 11, 10, 9, 8, 8, 9, 9, 10, -1, -1, 0, 0, 0, 0, 0, -1, -1, -1, 13, 12, 11, 9, 8, 8, 8, 9, 10, 11, 12, 12, -1, -1, 0, 0, 0, -1, -1, 16, 16, 14, 11, 8, 7, 7, 7, 8, 9, 11, 12, 14, 15, 14, 0, 0, -1, -1, -1, 19, 18, 15, 12, 9, 7, 6, 6, 6, 7, 8, 10, 13, 16, 18, -1, 0, -1, -1, 23, 21, 20, 17, 14, 11, 9, 7, 6, 5, 5, 6, 8, 11, 17, 22, -1, 0, -1, -1, 25, 24, 23, 20, 17, 14, 12, 10, 8, 6, 5, 5, 6, 10, 17, 24, -1, -1, -1, -1, 28, 27, 26, 24, 22, 20, 18, 16, 13, 11, 9, 7, 7, 11, 19, 25, -1, -1, -1, -1, 30, 29, 29, 28, 27, 27, 26, 24, 20, 17, 14, 11, 10, 13, 20, 25, -1, -1, -1, 31, 30, 30, 30, 30, 30, 30, 30, 28, 24, 20, 17, 14, 13, 14, 20, 21, 0, -1, -1, 31, 30, 31, 30, 30, 30, 30, 29, 26, 23, 20, 17, 16, 15, 16, 18, 17, 0, -1, -1, 31, 31, 31, 30, 29, 28, 27, 26, 24, 21, 19, 17, 16, 16, 17, 17, -1, 0, -1, -1, 32, 32, 31, 30, 28, 27, 26, 25, 23, 21, 19, 18, 18, 18, 18, 18, -1, 0, -1, -1, 34, 34, 32, 30, 29, 28, 27, 25, 24, 22, 21, 20, 20, 20, 20, -1, -1, 0, -1, 37, 37, 37, 34, 32, 31, 29, 28, 27, 26, 25, 24, 23, 23, 21, 19, -1, 0, 0, -1, 41, 41, 40, 37, 35, 33, 32, 31, 30, 29, 29, 28, 27, 25, -1, -1, 0, 0, 0, -1, 44, 45, 43, 40, 38, 37, 36, 35, 34, 34, 34, 31, 27, -1, 0, 0, 0, 0, 0, -1, 48, 50, 47, 44, 42, 41, 40, 40, 40, 40, 38, 31, -1, 0, 0, 0, 0, 0, 0, -1, 55, 54, 50, 47, 45, 44, 44, 45, 47, 48, 44, -1, 0, 0, 0, 0, 0, 0, 0, -1, 59, 58, 54, 51, 49, 49, 49, 50, 53, 54, 51, -1, 0, 0, 0, 0, 0, 0, 0, 53, 63, 61, 57, 55, 53, 53, 54, 55, 59, 59, -1, -1, 0, 0, 0, 0, 0, 0, 0, 58, 67, 63, 60, 58, 57, 57, 58, 61, 63, 64, -1, -1, 0, 0, 0, 0, 0, 0, 0, 62, 70, 66, 63, 61, 61, 62, 63, 66, 67, 67, -1, -1, 0, 0, 0, 0, 0, 0, 0, 68, 72, 68, 65, 64, 65, 66, 67, 70, 71, 71, -1, -1, 0, 0, 0, 0, 0, 0, 0, 73, 73, 69, 68, 67, 68, 69, 72, 74, 74, 75, -1, -1, 0, 0, 0, 0, 0, 0, 0, 73, 75, 71, 70, 70, 71, 73, 75, 77, 77, 77, -1, -1, 0, 0, 0, 0, 0, 0, 0, 68, 74, 73, 72, 73, 74, 76, 79, 78, 81, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, 71, 71, 74, 75, 77, 79, 81, 82, 84, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 69, 68, 74, 79, 82, 84, 83, 85, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 69, 80, 87, 86, 87, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0
                    };

        private static short[] leftPoint = new short[]
                    {
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 8, 4, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 12, 10, 9, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 15, 13, 11, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 21, 19, 16, 14, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 25, 22, 20, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 29, 28, 26, 23, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, -1, 32, 31, 29, 24, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, 32, 34, 33, 31, 25, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, 27, 36, 36, 36, 32, -1, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 22, 22, 21, 23, 31, 38, 38, 37, 34, -1, 0, 0, 0, 0, -1, -1, -1, 29, 28, 26, 24, 21, 20, 25, 32, 38, 40, 38, -1, -1, 0, 0, 0, -1, -1, -1, 31, 32, 29, 25, 22, 19, 18, 23, 30, 38, 41, 39, -1, -1, 0, 0, 0, -1, -1, 31, 33, 31, 28, 23, 19, 16, 16, 21, 29, 38, 41, 39, -1, -1, 0, 0, -1, -1, 32, 33, 32, 29, 25, 21, 17, 15, 15, 19, 29, 38, 41, -1, -1, 0, 0, 0, -1, 36, 35, 34, 30, 26, 23, 19, 16, 15, 15, 19, 29, 38, 40, -1, -1, 0, 0, 0, -1, 37, 36, 33, 29, 25, 21, 19, 16, 15, 15, 20, 30, 38, 41, -1, -1, 0, 0, 0, 39, 39, 36, 32, 28, 25, 21, 19, 17, 16, 17, 21, 31, 35, 41, -1, -1, 0, 0, 0, 42, 40, 37, 32, 29, 25, 22, 20, 19, 18, 18, 23, 31, 35, 41, -1, -1, 0, 0, 0, 43, 42, 38, 33, 30, 27, 24, 22, 21, 21, 21, 24, 30, 35, -1, -1, 0, 0, 0, 0, 46, 45, 40, 35, 32, 29, 26, 25, 24, 24, 24, 25, 30, 34, -1, -1, 0, 0, 0, 0, 49, 48, 43, 38, 35, 32, 30, 29, 28, 28, 27, 27, 29, 31, -1, -1, 0, 0, 0, 0, 52, 52, 46, 42, 39, 36, 34, 34, 33, 32, 31, 31, 30, 31, -1, 0, 0, 0, 0, 0, 58, 56, 51, 47, 44, 42, 40, 40, 39, 38, 36, 34, 31, -1, -1, 0, 0, 0, 0, 0, 65, 61, 56, 52, 50, 48, 47, 46, 45, 44, 41, 38, 34, -1, -1, 0, 0, 0, 0, 0, 72, 66, 62, 59, 57, 55, 54, 54, 52, 50, 45, 42, 40, -1, -1, 0, 0, 0, 0, 0, 78, 71, 68, 67, 65, 64, 63, 62, 59, 56, 52, 48, -1, -1, 0, 0, 0, 0, 0, 0, -1, 78, 75, 74, 74, 73, 71, 68, 64, 61, 57, -1, -1, -1, 0, 0, 0, 0, 0, 0, -1, 79, 80, 81, 82, 81, 78, 73, 68, 66, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 76, 81, 84, 86, 81, 73, 70, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0
                    };

        private static short[] leftJazzHand = new short[]
                    {
                        0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 12, -1, 0, 0, -1, 12, 13, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, -1, 0, 0, -1, 13, 13, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, -1, 0, 0, -1, 15, 14, -1, 0, -1, 19, -1, 0, 0, 0, 0, 0, 0, 0, 13, 14, -1, 0, 0, 15, 18, 15, 0, 0, -1, 23, 21, 0, 0, 0, 0, -1, -1, 0, 14, 16, 14, 0, 0, 19, 21, 18, 0, 0, 21, 23, 23, 0, 0, 0, 0, 12, -1, 0, 16, 18, 17, 0, -1, 24, 24, 19, 0, -1, 24, 24, -1, 0, 0, 0, 0, 13, 11, -1, 19, 21, 20, -1, -1, 28, 26, 21, -1, 22, 26, 24, -1, 0, 0, 0, 0, 16, 15, -1, 21, 23, 22, -1, -1, 30, 28, 23, -1, 27, 27, 25, 0, 0, 0, 0, 0, 19, 19, -1, 23, 25, 24, 23, 29, 31, 30, 26, 26, 29, 28, -1, 0, 0, 0, 0, 0, 20, 23, 22, 26, 27, 26, 26, 32, 32, 31, 29, 31, 30, 28, -1, 0, 0, 0, 0, 0, 19, 25, 24, 26, 28, 27, 28, 32, 32, 32, 31, 32, 31, 27, 0, 0, 0, 0, 0, 0, -1, 26, 25, 27, 28, 27, 29, 31, 32, 32, 33, 33, 31, -1, 0, 0, 0, 0, 0, 0, -1, 25, 25, 25, 26, 26, 28, 30, 31, 32, 32, 33, 31, -1, 0, 0, 0, 0, 0, 0, 0, 23, 24, 23, 24, 26, 28, 30, 31, 31, 32, 34, 29, 0, 0, 0, 0, 0, 0, 0, 0, -1, 23, 22, 23, 26, 29, 31, 32, 33, 33, 34, 26, 0, 0, 0, 0, 0, 0, 0, 0, -1, 22, 21, 23, 27, 31, 34, 35, 35, 35, 35, -1, 0, 0, 0, -1, -1, -1, 0, 0, -1, 23, 22, 25, 29, 33, 36, 37, 37, 37, 36, -1, -1, 0, -1, -1, -1, -1, 0, 0, -1, 24, 24, 27, 31, 35, 39, 39, 39, 38, 37, 30, -1, -1, -1, 24, 23, 24, -1, 0, -1, 25, 27, 29, 33, 38, 41, 41, 39, 38, 36, 31, -1, 27, 27, 26, 26, 27, -1, 0, -1, 28, 29, 31, 35, 40, 42, 41, 39, 37, 36, 33, 31, 32, 29, 28, 27, -1, 0, 0, -1, 30, 31, 33, 37, 41, 42, 41, 38, 35, 34, 34, 33, 32, 31, 29, -1, -1, 0, 0, -1, 32, 33, 35, 38, 42, 42, 40, 37, 35, 34, 34, 34, 33, -1, -1, -1, 0, 0, 0, -1, 36, 35, 36, 39, 42, 42, 40, 37, 35, 35, 35, 34, -1, -1, 0, 0, 0, 0, 0, -1, -1, 37, 38, 41, 43, 43, 41, 39, 38, 37, 36, -1, -1, 0, 0, 0, 0, 0, 0, -1, -1, 41, 42, 44, 45, 45, 44, 42, 41, 40, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 47, 47, 49, 50, 49, 48, 48, 47, 47, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 58, 55, 56, 56, 56, 55, 54, 52, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 64, 65, 64, 64, 63, 64, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 65, 72, 73, 73, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0
                    };
        */

        // Right 'brofist'
        // 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 25, 28, 28, 26, 23, 20, 17, 16, 15, -1, -1, -1, 0, 0, 0, 0, 0, -1, -1, 31, 31, 30, 29, 29, 27, 24, 23, 21, 20, 19, 18, -1, -1, 0, 0, -1, -1, 33, 35, 34, 32, 29, 29, 28, 27, 25, 22, 21, 20, 19, 19, 19, -1, 0, 0, -1, 38, 40, 38, 35, 31, 29, 27, 26, 25, 23, 22, 20, 20, 19, 19, 20, 20, -1, 0, 32, 42, 41, 38, 34, 30, 27, 26, 25, 24, 22, 20, 19, 18, 18, 18, 19, 21, -1, -1, 38, 42, 40, 37, 33, 29, 26, 24, 23, 22, 20, 19, 18, 17, 17, 17, 19, 21, -1, -1, 40, 41, 38, 35, 31, 28, 24, 22, 21, 20, 19, 17, 16, 16, 16, 16, 18, 20, 22, -1, 40, 39, 36, 33, 29, 26, 23, 21, 19, 18, 17, 16, 15, 14, 14, 15, 16, 20, 24, -1, 39, 37, 34, 31, 27, 24, 21, 19, 18, 17, 16, 14, 14, 13, 13, 14, 15, 19, 24, -1, 38, 35, 31, 28, 25, 22, 19, 17, 16, 15, 14, 13, 13, 12, 12, 13, 15, 18, 23, -1, 36, 33, 29, 26, 22, 20, 17, 15, 14, 13, 13, 12, 11, 11, 11, 12, 14, 17, 22, -1, 34, 31, 26, 23, 20, 18, 15, 13, 12, 12, 11, 10, 10, 10, 10, 11, 14, 17, 21, -1, 32, 29, 24, 21, 18, 16, 13, 12, 11, 10, 10, 9, 9, 9, 9, 11, 14, 18, 21, -1, 30, 28, 23, 19, 16, 14, 12, 10, 9, 9, 8, 8, 8, 8, 9, 11, 15, 20, 22, -1, 28, 26, 21, 18, 15, 13, 11, 9, 8, 8, 8, 7, 8, 8, 9, 11, 15, 21, 23, 0, 26, 25, 20, 17, 14, 12, 10, 9, 8, 8, 7, 7, 7, 8, 9, 12, 17, 23, 25, 0, 24, 25, 20, 16, 13, 11, 10, 9, 8, 8, 8, 7, 8, 9, 11, 14, 19, 26, 29, 0, -1, 26, 21, 16, 13, 11, 10, 9, 8, 8, 8, 8, 9, 11, 13, 17, 22, 29, 35, 0, -1, 26, 23, 17, 14, 12, 11, 10, 10, 9, 9, 10, 11, 14, 17, 21, 26, 32, -1, 0, -1, 31, 26, 19, 16, 14, 12, 12, 11, 11, 12, 13, 16, 19, 23, 27, 31, 39, -1, 0, -1, 36, 30, 23, 18, 15, 14, 14, 13, 14, 15, 17, 21, 25, 29, 31, 36, 50, -1, 0, -1, 44, 35, 27, 21, 18, 17, 16, 16, 17, 18, 22, 27, 31, 35, 40, 48, -1, -1, 0, -1, 49, 40, 31, 24, 20, 19, 18, 18, 20, 22, 27, 32, 37, 44, 52, -1, -1, -1, 0, -1, 52, 43, 35, 27, 23, 21, 21, 21, 23, 26, 31, 36, 45, 57, -1, -1, -1, -1, 0, -1, 53, 46, 38, 30, 25, 23, 23, 25, 27, 31, 36, 42, 55, -1, -1, -1, -1, -1, 0, -1, 50, 46, 40, 32, 28, 26, 27, 29, 32, 35, 40, 51, -1, -1, -1, -1, -1, 0, 0, -1, -1, 45, 41, 35, 31, 30, 31, 32, 35, 39, 43, -1, -1, -1, -1, -1, -1, 0, 0, 0, -1, 43, 40, 36, 34, 33, 33, 35, 37, 41, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, -1, -1, 36, 35, 32, 30, 30, 32, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0
        // Left 'brofist'
        // 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 15, 16, 17, 20, 23, 26, 28, 28, 25, -1, -1, 0, 0, 0, 0, 0, -1, -1, 18, 19, 20, 21, 23, 24, 27, 29, 29, 30, 31, 31, -1, -1, 0, 0, 0, 0, -1, 19, 19, 19, 20, 21, 22, 25, 27, 28, 29, 29, 32, 34, 35, 33, -1, -1, 0, -1, 20, 20, 19, 19, 20, 20, 22, 23, 25, 26, 27, 29, 31, 35, 38, 40, 38, -1, 0, -1, 21, 19, 18, 18, 18, 19, 20, 22, 24, 25, 26, 27, 30, 34, 38, 41, 42, 32, 0, -1, 21, 19, 17, 17, 17, 18, 19, 20, 22, 23, 24, 26, 29, 33, 37, 40, 42, 38, -1, 22, 20, 18, 16, 16, 16, 16, 17, 19, 20, 21, 22, 24, 28, 31, 35, 38, 41, 40, -1, 24, 20, 16, 15, 14, 14, 15, 16, 17, 18, 19, 21, 23, 26, 29, 33, 36, 39, 40, -1, 24, 19, 15, 14, 13, 13, 14, 14, 16, 17, 18, 19, 21, 24, 27, 31, 34, 37, 39, -1, 23, 18, 15, 13, 12, 12, 13, 13, 14, 15, 16, 17, 19, 22, 25, 28, 31, 35, 38, -1, 22, 17, 14, 12, 11, 11, 11, 12, 13, 13, 14, 15, 17, 20, 22, 26, 29, 33, 36, -1, 21, 17, 14, 11, 10, 10, 10, 10, 11, 12, 12, 13, 15, 18, 20, 23, 26, 31, 34, -1, 21, 18, 14, 11, 9, 9, 9, 9, 10, 10, 11, 12, 13, 16, 18, 21, 24, 29, 32, -1, 22, 20, 15, 11, 9, 8, 8, 8, 8, 9, 9, 10, 12, 14, 16, 19, 23, 28, 30, -1, 23, 21, 15, 11, 9, 8, 8, 7, 8, 8, 8, 9, 11, 13, 15, 18, 21, 26, 28, -1, 25, 23, 17, 12, 9, 8, 7, 7, 7, 8, 8, 9, 10, 12, 14, 17, 20, 25, 26, 0, 29, 26, 19, 14, 11, 9, 8, 7, 8, 8, 8, 9, 10, 11, 13, 16, 20, 25, 24, 0, 35, 29, 22, 17, 13, 11, 9, 8, 8, 8, 8, 9, 10, 11, 13, 16, 21, 26, -1, 0, -1, 32, 26, 21, 17, 14, 11, 10, 9, 9, 10, 10, 11, 12, 14, 17, 23, 26, -1, 0, -1, 39, 31, 27, 23, 19, 16, 13, 12, 11, 11, 12, 12, 14, 16, 19, 26, 31, -1, 0, -1, 50, 36, 31, 29, 25, 21, 17, 15, 14, 13, 14, 14, 15, 18, 23, 30, 36, -1, 0, -1, -1, 48, 40, 35, 31, 27, 22, 18, 17, 16, 16, 17, 18, 21, 27, 35, 44, -1, 0, -1, -1, -1, 52, 44, 37, 32, 27, 22, 20, 18, 18, 19, 20, 24, 31, 40, 49, -1, 0, -1, -1, -1, -1, 57, 45, 36, 31, 26, 23, 21, 21, 21, 23, 27, 35, 43, 52, -1, 0, -1, -1, -1, -1, -1, 55, 42, 36, 31, 27, 25, 23, 23, 25, 30, 38, 46, 53, -1, 0, 0, -1, -1, -1, -1, -1, 51, 40, 35, 32, 29, 27, 26, 28, 32, 40, 46, 50, -1, 0, 0, -1, -1, -1, -1, -1, -1, 43, 39, 35, 32, 31, 30, 31, 35, 41, 45, -1, -1, 0, 0, 0, -1, -1, -1, -1, -1, -1, 41, 37, 35, 33, 33, 34, 36, 40, 43, -1, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, 32, 30, 30, 32, 35, 36, -1, -1, 0, 0

        /*
        private static short[] rightFist = new short[]
                    {
                        0, 0, 0, 0, 0, 0, 0, -1, 26, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 21, 27, 29, 28, 24, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 26, 24, 24, 25, 28, 27, 27, 28, 25, 23, 22, 20, -1, -1, 0, 0, 0, 0, -1, 26, 28, 27, 27, 28, 26, 25, 25, 26, 27, 27, 28, 28, 26, 25, 20, 0, 0, 0, 20, 28, 27, 26, 27, 26, 24, 22, 22, 24, 26, 26, 26, 27, 28, 29, 27, 13, 0, 0, 24, 26, 23, 22, 23, 22, 20, 18, 19, 21, 23, 24, 24, 26, 27, 28, 28, 24, -1, -1, 23, 22, 19, 18, 18, 18, 17, 15, 15, 18, 20, 21, 21, 23, 25, 26, 27, 27, 18, -1, 21, 19, 15, 13, 13, 13, 13, 12, 12, 14, 16, 18, 18, 20, 22, 23, 25, 26, 23, -1, 18, 15, 11, 9, 9, 10, 10, 9, 10, 11, 13, 15, 16, 17, 19, 21, 22, 24, 25, -1, 16, 12, 8, 6, 6, 7, 7, 7, 7, 9, 11, 13, 14, 15, 17, 18, 19, 22, 25, -1, 14, 10, 7, 5, 4, 5, 6, 5, 5, 7, 9, 11, 12, 13, 14, 16, 17, 20, 25, 0, 12, 9, 6, 4, 3, 4, 4, 4, 4, 5, 7, 9, 10, 11, 13, 14, 15, 19, 24, 0, 10, 8, 6, 4, 3, 4, 4, 3, 3, 4, 6, 8, 9, 10, 11, 13, 14, 18, 23, 0, -1, 9, 6, 5, 4, 5, 4, 3, 3, 4, 5, 7, 8, 9, 11, 12, 14, 17, 20, 0, -1, 9, 7, 6, 6, 6, 5, 4, 3, 4, 6, 7, 9, 10, 11, 12, 14, 17, 19, 0, -1, 11, 9, 7, 7, 7, 6, 4, 4, 5, 7, 9, 10, 11, 13, 14, 16, 18, 22, 0, -1, 13, 11, 8, 7, 7, 6, 5, 5, 7, 9, 11, 11, 13, 15, 17, 18, 21, -1, 0, -1, 14, 11, 8, 8, 7, 6, 6, 5, 7, 10, 13, 14, 16, 18, 20, 22, 27, -1, 0, 14, 15, 11, 8, 7, 7, 6, 6, 5, 7, 12, 17, 19, 21, 23, 25, 29, 35, -1, 0, 18, 16, 11, 8, 7, 7, 6, 6, 6, 7, 16, 25, 32, 33, 34, 35, 38, 43, -1, -1, 22, 19, 12, 9, 8, 7, 7, 7, 8, 15, 30, 41, 46, 48, 47, 47, 50, 51, -1, -1, 25, 21, 16, 12, 10, 10, 12, 16, 23, 34, 44, 51, 57, 58, 57, 56, 57, 55, -1, -1, 27, 25, 21, 17, 18, 19, 24, 31, 38, 44, 51, 58, 61, 61, 61, 61, 62, 57, -1, -1, 25, 27, 26, 25, 28, 32, 35, 41, 46, 51, 58, 62, 64, 64, 63, 64, 65, 55, -1, 0, 25, 27, 28, 32, 35, 38, 41, 46, 51, 56, 61, 64, 66, 67, 67, 67, 67, 57, -1, 0, -1, 26, 29, 34, 38, 42, 45, 50, 55, 61, 65, 68, 70, 70, 71, 72, 70, 64, -1, 0, 0, -1, -1, 31, 37, 41, 46, 51, 58, 65, 69, 72, 75, 76, 76, 77, 75, 69, -1, 0, 0, 0, -1, -1, 36, 40, 44, 52, 62, 71, 75, 78, 81, 82, 83, 83, 78, -1, 0, 0, 0, 0, 0, 0, -1, -1, -1, 51, 66, 80, 83, 85, 87, 89, 88, 85, 76, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 79, 86, 90, 91, 86, 84, 75, -1, 0, 0
                    };

        private static short[] rightPoint = new short[]
                    {
                        0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 2, 3, 3, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 6, 7, 8, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 9, 10, 12, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 15, 16, 18, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 19, 21, 25, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 24, 27, 30, 30, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 28, 33, 34, 36, 32, 0, 0, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 37, 38, 40, 38, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 40, 42, 44, 46, 44, 45, 49, 57, 53, 49, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 42, 46, 47, 50, 54, 57, 56, 55, 56, 56, 53, -1, -1, 0, 0, 0, 0, 0, 0, -1, 46, 51, 51, 52, 54, 54, 50, 48, 51, 58, 59, 55, 47, -1, 0, 0, 0, 0, 0, -1, 48, 55, 55, 54, 53, 49, 43, 41, 44, 54, 62, 64, 60, 47, 0, 0, 0, 0, 0, -1, 50, 57, 58, 56, 53, 44, 37, 37, 39, 50, 61, 64, 65, 61, -1, 0, 0, 0, 0, 0, 48, 59, 61, 59, 53, 39, 34, 34, 36, 45, 58, 62, 64, 65, 58, -1, 0, 0, 0, 0, -1, 60, 65, 63, 56, 36, 34, 34, 35, 43, 55, 59, 61, 64, 66, 57, -1, 0, 0, 0, -1, 61, 69, 67, 62, 37, 34, 35, 36, 42, 53, 57, 60, 63, 66, 66, 55, 0, 0, 0, -1, 62, 72, 70, 65, 39, 36, 36, 38, 44, 51, 54, 57, 61, 65, 69, 62, 0, 0, 0, 0, 61, 74, 71, 60, 38, 37, 38, 40, 45, 49, 52, 56, 60, 64, 68, 70, 0, 0, 0, 0, -1, 66, 60, 45, 36, 37, 40, 42, 46, 48, 51, 54, 59, 63, 67, 71, 0, 0, 0, 0, -1, 46, 44, 38, 34, 36, 41, 44, 46, 48, 50, 54, 58, 62, 67, 71, 0, 0, 0, 0, -1, 41, 40, 36, 33, 36, 43, 46, 47, 48, 50, 54, 58, 61, 65, 68, 0, 0, 0, 0, -1, 41, 42, 39, 35, 39, 47, 50, 49, 49, 51, 55, 58, 61, 63, 65, 0, 0, 0, 0, -1, 42, 44, 42, 40, 44, 55, 56, 53, 52, 53, 56, 58, 60, 56, -1, 0, 0, 0, 0, -1, 41, 47, 47, 48, 59, 63, 63, 59, 55, 56, 57, 59, 58, -1, 0, 0, 0, 0, 0, 0, -1, 48, 54, 61, 66, 72, 70, 66, 61, 58, 59, 59, 53, -1, 0, 0, 0, 0, 0, 0, -1, 47, 61, 69, 74, 77, 78, 72, 66, 62, 59, 58, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 51, 66, 76, 78, 74, 64, 58, 56, 58, 51, -1, 0, 0
                    };

        private static short[] rightJazzHand = new short[]
                    {
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 3, 3, -1, -1, -1, 4, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 4, 5, -1, -1, -1, 5, 5, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, 7, 8, 9, -1, -1, 7, 7, -1, 0, 0, 0, 0, 0, 0, 0, 9, 11, 10, -1, -1, 10, 11, 12, -1, -1, 10, 9, -1, 0, 0, 0, 0, 0, 0, -1, 12, 13, 13, -1, -1, 13, 15, 16, -1, -1, 13, 13, -1, 0, -1, -1, 0, 0, 0, 0, -1, 15, 16, 15, -1, 17, 19, 20, 20, -1, 16, 16, -1, 0, -1, 10, 0, 0, 0, 0, -1, 18, 19, 20, -1, -1, 22, 23, 23, 21, 19, 20, -1, 0, 11, 13, 0, 0, 0, 0, -1, 21, 22, 23, 22, -1, 25, 27, 26, 25, 23, 24, -1, 0, 15, 17, 0, 0, 0, 0, -1, -1, 25, 27, 25, 22, 27, 28, 29, 28, 26, 27, -1, 0, 20, 21, 0, 0, 0, 0, 0, -1, 27, 29, 29, 27, 29, 30, 31, 31, 28, 28, 23, -1, 26, 25, 0, 0, 0, 0, 0, -1, 27, 30, 32, 30, 31, 32, 32, 31, 30, 30, 26, -1, 29, 28, 0, 0, 0, 0, 0, 0, -1, 30, 33, 33, 33, 33, 32, 32, 31, 31, 30, 27, 31, 29, 0, 0, 0, 0, 0, 0, -1, 31, 34, 34, 33, 33, 32, 31, 31, 31, 31, 31, 32, 29, 0, 0, 0, 0, 0, 0, 0, 30, 35, 34, 34, 34, 33, 32, 31, 31, 31, 31, 32, 27, 0, 0, 0, 0, 0, 0, 0, -1, 36, 36, 36, 36, 35, 34, 32, 31, 30, 31, 32, 29, 0, -1, -1, -1, 0, 0, 0, -1, 37, 39, 38, 38, 38, 36, 34, 32, 31, 31, 32, -1, 0, -1, -1, -1, -1, -1, 0, -1, 36, 41, 41, 41, 41, 40, 37, 35, 32, 32, 33, -1, 0, 21, 22, 24, 25, -1, -1, -1, 38, 42, 43, 44, 44, 43, 40, 38, 35, 34, 34, -1, 0, 24, 24, 26, 28, 28, 29, 30, 39, 42, 44, 46, 47, 46, 44, 41, 38, 37, 37, -1, 0, 27, 27, 29, 30, 33, 34, 36, 40, 42, 44, 47, 48, 49, 47, 43, 40, 40, 39, -1, 0, -1, -1, 29, 33, 34, 36, 38, 40, 42, 44, 47, 50, 50, 49, 46, 43, 42, 41, -1, 0, 0, -1, -1, 32, 35, 38, 39, 40, 42, 44, 47, 50, 52, 51, 48, 46, 45, 43, -1, 0, 0, 0, 0, -1, -1, 37, 40, 41, 42, 44, 47, 50, 52, 52, 50, 48, 48, 45, -1, 0, 0, 0, 0, 0, -1, -1, 41, 42, 44, 46, 49, 51, 53, 54, 52, 51, 51, 49, -1, 0, 0, 0, 0, 0, 0, 0, -1, 42, 46, 49, 51, 53, 55, 56, 55, 54, 55, 51, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 43, 50, 54, 57, 58, 59, 59, 59, 57, 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 55, 62, 64, 65, 66, 66, 66, 67, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 70, 72, 73, 73, 73, 72, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 81, 82, 82, 79, 74, -1, 0, 0
                    };

        private static short[] leftFist = new short[]
                    {
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 26, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 24, 28, 29, 27, 21, -1, -1, -1, 0, 0, 0, 0, 0, 0, -1, -1, 20, 22, 23, 25, 28, 27, 27, 28, 25, 24, 24, 26, 22, 0, 0, 0, 0, 20, 25, 26, 28, 28, 27, 27, 26, 25, 25, 26, 28, 27, 27, 28, 26, -1, 0, 0, 13, 27, 29, 28, 27, 26, 26, 26, 24, 22, 22, 24, 26, 27, 26, 27, 28, 20, 0, -1, 24, 28, 28, 27, 26, 24, 24, 23, 21, 19, 18, 20, 22, 23, 22, 23, 26, 24, 0, 18, 27, 27, 26, 25, 23, 21, 21, 20, 18, 15, 15, 17, 18, 18, 18, 19, 22, 23, -1, 23, 26, 25, 23, 22, 20, 18, 18, 16, 14, 12, 12, 13, 13, 13, 13, 15, 19, 21, -1, 25, 24, 22, 21, 19, 17, 16, 15, 13, 11, 10, 9, 10, 10, 9, 9, 11, 15, 18, -1, 25, 22, 19, 18, 17, 15, 14, 13, 11, 9, 7, 7, 7, 7, 6, 6, 8, 12, 16, -1, 25, 20, 17, 16, 14, 13, 12, 11, 9, 7, 5, 5, 6, 5, 4, 5, 7, 10, 14, -1, 24, 19, 15, 14, 13, 11, 10, 9, 7, 5, 4, 4, 4, 4, 3, 4, 6, 9, 12, 0, 23, 18, 14, 13, 11, 10, 9, 8, 6, 4, 3, 3, 4, 4, 3, 4, 6, 8, 10, 0, 20, 17, 14, 12, 11, 9, 8, 7, 5, 4, 3, 3, 4, 5, 4, 5, 6, 9, -1, 0, 19, 17, 14, 12, 11, 10, 9, 7, 6, 4, 3, 4, 5, 6, 6, 6, 7, 9, -1, 0, 22, 18, 16, 14, 13, 11, 10, 9, 7, 5, 4, 4, 6, 7, 7, 7, 9, 11, -1, 0, -1, 21, 18, 17, 15, 13, 11, 11, 9, 7, 5, 5, 6, 7, 7, 8, 11, 13, -1, 0, -1, 27, 22, 20, 18, 16, 14, 13, 10, 7, 5, 6, 6, 7, 8, 8, 11, 14, -1, 0, -1, 35, 29, 25, 23, 21, 19, 17, 12, 7, 5, 6, 6, 7, 7, 8, 11, 15, 14, 0, -1, 43, 38, 35, 34, 33, 32, 25, 16, 7, 6, 6, 6, 7, 7, 8, 11, 16, 18, 0, -1, 51, 50, 47, 47, 48, 46, 41, 30, 15, 8, 7, 7, 7, 8, 9, 12, 19, 22, -1, -1, 55, 57, 56, 57, 58, 57, 51, 44, 34, 23, 16, 12, 10, 10, 12, 16, 21, 25, -1, -1, 57, 62, 61, 61, 61, 61, 58, 51, 44, 38, 31, 24, 19, 18, 17, 21, 25, 27, -1, -1, 55, 65, 64, 63, 64, 64, 62, 58, 51, 46, 41, 35, 32, 28, 25, 26, 27, 25, -1, -1, 57, 67, 67, 67, 67, 66, 64, 61, 56, 51, 46, 41, 38, 35, 32, 28, 27, 25, 0, -1, 64, 70, 72, 71, 70, 70, 68, 65, 61, 55, 50, 45, 42, 38, 34, 29, 26, -1, 0, -1, 69, 75, 77, 76, 76, 75, 72, 69, 65, 58, 51, 46, 41, 37, 31, -1, -1, 0, 0, 0, -1, 78, 83, 83, 82, 81, 78, 75, 71, 62, 52, 44, 40, 36, -1, -1, 0, 0, 0, 0, -1, 76, 85, 88, 89, 87, 85, 83, 80, 66, 51, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, 75, 84, 86, 91, 90, 86, 79, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0
                    };

        private static short[] leftPoint = new short[]
                    {
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 3, 3, 2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 5, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 7, 6, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 12, 10, 9, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 18, 16, 15, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 25, 21, 19, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 30, 30, 27, 24, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 32, 36, 34, 33, 28, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, 38, 40, 38, 37, 30, 0, 0, 0, 0, 0, 0, 0, 0, -1, 49, 53, 57, 49, 45, 44, 46, 44, 42, 40, 31, 0, 0, 0, 0, 0, 0, -1, -1, 53, 56, 56, 55, 56, 57, 54, 50, 47, 46, 42, -1, 0, 0, 0, 0, 0, -1, 47, 55, 59, 58, 51, 48, 50, 54, 54, 52, 51, 51, 46, -1, 0, 0, 0, 0, 0, 47, 60, 64, 62, 54, 44, 41, 43, 49, 53, 54, 55, 55, 48, -1, 0, 0, 0, 0, -1, 61, 65, 64, 61, 50, 39, 37, 37, 44, 53, 56, 58, 57, 50, -1, 0, 0, 0, -1, 58, 65, 64, 62, 58, 45, 36, 34, 34, 39, 53, 59, 61, 59, 48, 0, 0, 0, -1, 57, 66, 64, 61, 59, 55, 43, 35, 34, 34, 36, 56, 63, 65, 60, -1, 0, 0, 0, 55, 66, 66, 63, 60, 57, 53, 42, 36, 35, 34, 37, 62, 67, 69, 61, -1, 0, 0, 0, 62, 69, 65, 61, 57, 54, 51, 44, 38, 36, 36, 39, 65, 70, 72, 62, -1, 0, 0, 0, 70, 68, 64, 60, 56, 52, 49, 45, 40, 38, 37, 38, 60, 71, 74, 61, 0, 0, 0, 0, 71, 67, 63, 59, 54, 51, 48, 46, 42, 40, 37, 36, 45, 60, 66, -1, 0, 0, 0, 0, 71, 67, 62, 58, 54, 50, 48, 46, 44, 41, 36, 34, 38, 44, 46, -1, 0, 0, 0, 0, 68, 65, 61, 58, 54, 50, 48, 47, 46, 43, 36, 33, 36, 40, 41, -1, 0, 0, 0, 0, 65, 63, 61, 58, 55, 51, 49, 49, 50, 47, 39, 35, 39, 42, 41, -1, 0, 0, 0, 0, -1, 56, 60, 58, 56, 53, 52, 53, 56, 55, 44, 40, 42, 44, 42, -1, 0, 0, 0, 0, 0, -1, 58, 59, 57, 56, 55, 59, 63, 63, 59, 48, 47, 47, 41, -1, 0, 0, 0, 0, 0, -1, 53, 59, 59, 58, 61, 66, 70, 72, 66, 61, 54, 48, -1, 0, 0, 0, 0, 0, 0, 0, -1, 58, 59, 62, 66, 72, 78, 77, 74, 69, 61, 47, -1, 0, 0, 0, 0, 0, 0, 0, -1, 51, 58, 56, 58, 64, 74, 78, 76, 66, 51, -1, 0, 0, 0, 0, 0, 0
                    };

        private static short[] leftJazzHand = new short[]
                    {
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, -1, -1, -1, 3, 3, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 5, 5, -1, -1, -1, 5, 4, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 7, 7, -1, -1, 9, 8, 7, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, -1, 9, 10, -1, -1, 12, 11, 10, -1, -1, 10, 11, 9, 0, 0, 0, 0, -1, -1, 0, -1, 13, 13, -1, -1, 16, 15, 13, -1, -1, 13, 13, 12, -1, 0, 0, 0, 10, -1, 0, -1, 16, 16, -1, 20, 20, 19, 17, -1, 15, 16, 15, -1, 0, 0, 0, 0, 13, 11, 0, -1, 20, 19, 21, 23, 23, 22, -1, -1, 20, 19, 18, -1, 0, 0, 0, 0, 17, 15, 0, -1, 24, 23, 25, 26, 27, 25, -1, 22, 23, 22, 21, -1, 0, 0, 0, 0, 21, 20, 0, -1, 27, 26, 28, 29, 28, 27, 22, 25, 27, 25, -1, -1, 0, 0, 0, 0, 25, 26, -1, 23, 28, 28, 31, 31, 30, 29, 27, 29, 29, 27, -1, 0, 0, 0, 0, 0, 28, 29, -1, 26, 30, 30, 31, 32, 32, 31, 30, 32, 30, 27, -1, 0, 0, 0, 0, 0, 29, 31, 27, 30, 31, 31, 32, 32, 33, 33, 33, 33, 30, -1, 0, 0, 0, 0, 0, 0, 29, 32, 31, 31, 31, 31, 31, 32, 33, 33, 34, 34, 31, -1, 0, 0, 0, 0, 0, 0, 27, 32, 31, 31, 31, 31, 32, 33, 34, 34, 34, 35, 30, 0, 0, 0, 0, 0, 0, 0, 29, 32, 31, 30, 31, 32, 34, 35, 36, 36, 36, 36, -1, 0, 0, 0, 0, 0, 0, 0, -1, 32, 31, 31, 32, 34, 36, 38, 38, 38, 39, 37, -1, 0, 0, 0, -1, -1, -1, 0, -1, 33, 32, 32, 35, 37, 40, 41, 41, 41, 41, 36, -1, 0, -1, -1, -1, -1, -1, 0, -1, 34, 34, 35, 38, 40, 43, 44, 44, 43, 42, 38, -1, -1, -1, 25, 24, 22, 21, 0, -1, 37, 37, 38, 41, 44, 46, 47, 46, 44, 42, 39, 30, 29, 28, 28, 26, 24, 24, 0, -1, 39, 40, 40, 43, 47, 49, 48, 47, 44, 42, 40, 36, 34, 33, 30, 29, 27, 27, 0, -1, 41, 42, 43, 46, 49, 50, 50, 47, 44, 42, 40, 38, 36, 34, 33, 29, -1, -1, 0, -1, 43, 45, 46, 48, 51, 52, 50, 47, 44, 42, 40, 39, 38, 35, 32, -1, -1, 0, 0, -1, 45, 48, 48, 50, 52, 52, 50, 47, 44, 42, 41, 40, 37, -1, -1, 0, 0, 0, 0, -1, 49, 51, 51, 52, 54, 53, 51, 49, 46, 44, 42, 41, -1, -1, 0, 0, 0, 0, 0, -1, 51, 55, 54, 55, 56, 55, 53, 51, 49, 46, 42, -1, 0, 0, 0, 0, 0, 0, 0, 0, 57, 57, 59, 59, 59, 58, 57, 54, 50, 43, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 67, 66, 66, 66, 65, 64, 62, 55, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 72, 73, 73, 73, 72, 70, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 74, 79, 82, 82, 81, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
                    };
        */

        /* Old nondepth gestures
        private static short[] rightLDefault = new short[]
                    {
                        0, 0, 0, 0, 0, 0, 500, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 500, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 500, 0, 0, 500, 500, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 500, 500, 500, 500, 500, 500, 500, 500, 0, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 500, 500, 500, 500, 500, 500, 500, 500, 500, 0, 0, 0, 0, 0, 0, 500, 500, 1000, 1000, 1000, 1000, 500, 1000, 1000, 1000, 1000, 500, 500, 500, 500, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 500, 500, 500, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 500, 1000, 1000, 1000, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 0, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0
                    };

        private static short[] rightEvulDefault = new short[]
                    {
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 500, 0, 0, 0, 0, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 1000, 1000, 1000, 500, 0, 0, 500, 1000, 1000, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 1000, 1000, 1000, 500, 0, 0, 500, 1000, 1000, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 1000, 1000, 1000, 500, 500, 0, 500, 1000, 1000, 1000, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 500, 0, 500, 1000, 1000, 1000, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 500, 0, 1000, 1000, 1000, 1000, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 500, 0, 1000, 1000, 1000, 1000, 1000, 500, 500, 500, 500, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 500, 0, 500, 1000, 1000, 1000, 1000, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 500, 0, 0, 0, 0, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 500, 0, 0, 0, 0, 0, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 500, 0, 0, 0, 0, 0, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 500, 0, 0, 0, 0, 0, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 500, 0, 0, 0, 0, 0, 0, 0, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 500, 500, 0, 0, 0, 0
                    };

        private static short[] rightPointDefault = new short[]
                    {
                        0, 0, 500, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 500, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 500, 0, 500, 500, 500, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 500, 500, 500, 500, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 500, 500, 1000, 1000, 1000, 500, 500, 0, 0, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 500, 1000, 1000, 1000, 1000, 1000, 500, 500, 500, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 500, 500, 500, 0, 0, 0, 0, 0, 0, 0, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 500, 500, 0, 0, 0, 0, 0, 0, 0, 0, 500, 500, 1000, 1000, 1000, 1000, 1000, 500, 500, 500, 0, 0, 0, 0
                    };

        private static short[] leftLDefault = new short[]
                    {
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 500, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 500, 500, 0, 0, 500, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 0, 500, 500, 500, 500, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 500, 500, 500, 500, 500, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 500, 1000, 1000, 1000, 1000, 500, 500, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 500, 500, 500, 500, 500, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 1000, 1000, 1000, 500, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 500, 500, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 500, 500, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 0, 0, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 0, 0, 0, 0, 0, 0, 0, 0
                    };

        private static short[] leftEvulDefault = new short[]
                    {
                        0, 0, 0, 500, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 0, 0, 500, 1000, 1000, 1000, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 1000, 1000, 500, 0, 500, 500, 1000, 1000, 1000, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 1000, 1000, 500, 0, 500, 1000, 1000, 1000, 1000, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 1000, 1000, 1000, 500, 0, 500, 1000, 1000, 1000, 1000, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 1000, 1000, 1000, 500, 0, 500, 1000, 1000, 1000, 1000, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 0, 500, 1000, 1000, 1000, 1000, 1000, 500, 500, 500, 500, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 1000, 1000, 1000, 1000, 500, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 0, 0, 0, 0, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 500, 0, 0, 0, 0, 0, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 500, 0, 0, 0, 0, 0, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 500, 0, 0, 0, 0, 0, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 500, 500, 0, 0, 0, 0, 0, 0, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 500, 500, 0, 0, 0, 0, 0, 0, 0, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 500, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 500, 1000, 1000, 1000, 1000, 1000, 500, 500, 500, 0, 0, 0, 0, 0, 0
                    };

        private static short[] leftPointDefault = new short[]
                    {
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 500, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 500, 500, 500, 0, 500, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 500, 1000, 1000, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 0, 500, 500, 1000, 1000, 1000, 500, 500, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 500, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, 0, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 0, 0, 0, 0, 0, 0, 500, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 500, 0, 0, 0, 0, 0, 0, 0, 0, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 500, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 500, 500, 0, 0, 0, 0, 0, 0
                    };
        */

        public static bool IdentifyGesture(bool isRight, short[] resizedHandArray, Hand targetHand)
        {
            List<short[]> leftClickGestureData = new List<short[]>();
            List<short[]> rightClickGestureData = new List<short[]>();
            List<short[]> moveGestureData = new List<short[]>();

            if (MouseInputControl.alternativeGestures)
            {
                if (isRight)
                {
                    leftClickGestureData.Add(rightFistRotated);
                    leftClickGestureData.Add(rightHerpFistRotated);
                    leftClickGestureData.Add(rightDerpFistRotated);
                    leftClickGestureData.Add(rightBrofistRotated);
                    //rightClickGestureData = null;
                    //moveGestureData = null;
                }
                else
                {
                    leftClickGestureData.Add(leftFistRotated);
                    leftClickGestureData.Add(leftHerpFistRotated);
                    leftClickGestureData.Add(leftDerpFistRotated);
                    leftClickGestureData.Add(leftBrofistRotated);
                    //rightClickGestureData = null;
                    //moveGestureData = null;
                }
            }
            else
            {
                if (isRight)
                {
                    leftClickGestureData.Add(rightLoserRotated);
                    leftClickGestureData.Add(rightLoserPointRotated);

                    moveGestureData.Add(rightFistRotated);
                    moveGestureData.Add(rightBrofistRotated);
                    moveGestureData.Add(rightDerpFistRotated);
                    moveGestureData.Add(rightHerpFistRotated);
                    
                    //rightClickGestureData = null;
                }
                else
                {
                    leftClickGestureData.Add(leftLoserRotated);
                    leftClickGestureData.Add(leftLoserPointRotated);

                    moveGestureData.Add(leftFistRotated);
                    moveGestureData.Add(leftBrofistRotated);
                    moveGestureData.Add(leftDerpFistRotated);
                    moveGestureData.Add(leftHerpFistRotated);

                    //rightClickGestureData = null;
                }
            }

            // TODO: replace with more dynamic list to sort through?
            double[] leftClickHits = new double[leftClickGestureData.Count];
            double[] leftClickTotal = new double[leftClickGestureData.Count];

            double[] moveHits = new double[moveGestureData.Count];
            double[] moveTotal = new double[moveGestureData.Count];

            double[] rightClickHits = new double[rightClickGestureData.Count];
            double[] rightClickTotal = new double[rightClickGestureData.Count];

            for (int i = 0; i < resizedHandArray.Length; ++i)
            {
                if (resizedHandArray[i] == 0)
                { // hand array pixel is background

                    for (int gestureIndex = 0; gestureIndex < leftClickGestureData.Count; ++gestureIndex)
                    {
                        if (leftClickGestureData[gestureIndex][i] == 0)
                        {
                            leftClickHits[gestureIndex] += 100;
                        }
                    }

                    for (int gestureIndex = 0; gestureIndex < moveGestureData.Count; ++gestureIndex)
                    {
                        if (moveGestureData[gestureIndex][i] == 0)
                        {
                            moveHits[gestureIndex] += 100;
                        }
                    }

                    for (int gestureIndex = 0; gestureIndex < rightClickGestureData.Count; ++gestureIndex)
                    {
                        if (rightClickGestureData[gestureIndex][i] == 0)
                        {
                            rightClickHits[gestureIndex] += 100;
                        }
                    }
                }
                else if (resizedHandArray[i] > 0)
                { // hand array pixel is part of the hand
                    for (int gestureIndex = 0; gestureIndex < leftClickGestureData.Count; ++gestureIndex)
                    {
                        if (leftClickGestureData[gestureIndex][i] > 0)
                        {
                            double deviation = resizedHandArray[i] - leftClickGestureData[gestureIndex][i];

                            if (deviation < 0)
                            {
                                deviation *= -1;
                            }

                            leftClickHits[gestureIndex] += 100 - deviation;
                        }
                    }

                    for (int gestureIndex = 0; gestureIndex < moveGestureData.Count; ++gestureIndex)
                    {
                        if (moveGestureData[gestureIndex][i] > 0)
                        {
                            double deviation = resizedHandArray[i] - moveGestureData[gestureIndex][i];

                            if (deviation < 0)
                            {
                                deviation *= -1;
                            }

                            moveHits[gestureIndex] += 100 - deviation;
                        }
                    }

                    for (int gestureIndex = 0; gestureIndex < rightClickGestureData.Count; ++gestureIndex)
                    {
                        if (rightClickGestureData[gestureIndex][i] > 0)
                        {
                            double deviation = resizedHandArray[i] - rightClickGestureData[gestureIndex][i];

                            if (deviation < 0)
                            {
                                deviation *= -1;
                            }

                            rightClickHits[gestureIndex] += 100 - deviation;
                        }
                    }
                }

                // Count totals where appropriate
                for (int gestureIndex = 0; gestureIndex < leftClickGestureData.Count; ++gestureIndex)
                {
                    if (leftClickGestureData[gestureIndex][i] != -1)
                    {
                        leftClickTotal[gestureIndex] += 100;
                    }
                }

                for (int gestureIndex = 0; gestureIndex < moveGestureData.Count; ++gestureIndex)
                {
                    if (moveGestureData[gestureIndex][i] != -1)
                    {
                        moveTotal[gestureIndex] += 100;
                    }
                }

                for (int gestureIndex = 0; gestureIndex < rightClickGestureData.Count; ++gestureIndex)
                {
                    if (rightClickGestureData[gestureIndex][i] != -1)
                    {
                        rightClickTotal[gestureIndex] += 100;
                    }
                }
            }

            double leftClickAccuracy = 0;
            double moveAccuracy = 0;
            double rightClickAccuracy = 0;

            for (int gestureIndex = 0; gestureIndex < leftClickGestureData.Count; ++gestureIndex)
            {
                leftClickAccuracy = Math.Max(leftClickAccuracy, leftClickHits[gestureIndex] / leftClickTotal[gestureIndex]);
            }

            for (int gestureIndex = 0; gestureIndex < moveGestureData.Count; ++gestureIndex)
            {
                moveAccuracy = Math.Max(moveAccuracy, moveHits[gestureIndex] / moveTotal[gestureIndex]);
            }

            for (int gestureIndex = 0; gestureIndex < rightClickGestureData.Count; ++gestureIndex)
            {
                rightClickAccuracy = Math.Max(rightClickAccuracy, rightClickHits[gestureIndex] / rightClickTotal[gestureIndex]);
            }

#if DEBUG
            // TODO: here´d be pretty nifty point for debug
#endif
            // Try using multiple gesture data

            // Add new gesturedata to memory
            Dictionary<HandGestures, double> gestureSet = new Dictionary<HandGestures, double>();

            gestureSet.Add(HandGestures.A, leftClickAccuracy);
            gestureSet.Add(HandGestures.B, rightClickAccuracy);
            gestureSet.Add(HandGestures.Neutral, moveAccuracy);

            targetHand.GestureCollection.Add(gestureSet);

            // Remove oldest gesture data
            if (targetHand.GestureCollection.Count() > MouseInputControl.gestureMemoryCount)
            {
                targetHand.GestureCollection.RemoveAt(0);
            }

            // Get gesture based on latest datas
            int foundGestures = 0;
            double totalLeftClickAccuracy = 0.0D;
            double totalMoveAccuracy = 0.0D;
            double totalRightClickAccuracy = 0.0D;

            foreach (Dictionary<HandGestures, double> gestureData in targetHand.GestureCollection)
            {
                foundGestures++;

                totalLeftClickAccuracy += gestureData[HandGestures.A];
                totalRightClickAccuracy += gestureData[HandGestures.B];
                totalMoveAccuracy += gestureData[HandGestures.Neutral];
            }

            if (foundGestures == 0)
                return false;

            if ((totalLeftClickAccuracy >= totalRightClickAccuracy) && (totalLeftClickAccuracy >= totalMoveAccuracy))
            {
                targetHand.Gesture = HandGestures.A;
                targetHand.GestureAccuracy = totalLeftClickAccuracy / foundGestures;
            }
            else if ((totalRightClickAccuracy >= totalLeftClickAccuracy) && (totalRightClickAccuracy >= totalMoveAccuracy))
            {
                targetHand.Gesture = HandGestures.B;
                targetHand.GestureAccuracy = totalRightClickAccuracy / foundGestures;
            }
            else
            {
                targetHand.Gesture = HandGestures.Neutral;
                targetHand.GestureAccuracy = totalMoveAccuracy / foundGestures;
            }

            return true;
        }

        // Debug code used for acquiring gestures, coding a proper UI would be work and I hate work
        private static int counter = 500;
        private static short[] handCollection;
        private static int[] handCollectionTempData;
        private static HandGestures targeteGesture;
        public static void LearnGestureEvent(bool isRight, short[] resizedHandArray)
        {
            if (counter >= 500)
                return;

            // Should probably save a list somewhere...
            for (int i = 0; i < resizedHandArray.Length; ++i)
            {
                if (resizedHandArray[i] > 0)
                {
                    ++handCollection[i];
                    handCollectionTempData[i] += resizedHandArray[i];
                }
            }

            ++counter;

            if (counter == 500)
            {
                string resizedArrayString = "";

                for (int i = 0; i < handCollection.Count(); ++i)
                {
                    short dada = handCollection[i];

                    if (dada < 76) // < 76
                    {
                        resizedArrayString += ", 0";
                    }
                    else if (dada > 300) // > 250
                    {
                        short average = (short)(handCollectionTempData[i] / dada);

                        resizedArrayString += ", " + average;
                    }
                    else
                    {
                        resizedArrayString += ", -1";
                    }
                }

                // Breakpoint here! we don´t save array yet!
            }
        }

        public static void SetLearnGesture(HandGestures newTargetGesture)
        {
            counter = 0;
            handCollection = new short[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            handCollectionTempData = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            targeteGesture = newTargetGesture;
        }

        public static void GestureSwitcheroo()
        {
            string reversies = "";

            for (int y = 0; y < PicHeight; ++y)
            {
                for (int x = PicWidth - 1; x >= 0; --x)
                {
                    int originalIndex = 0;
                    originalIndex += y * PicWidth;
                    originalIndex += x;

                    // original gesture data goes here
                    reversies += rightLoserPointRotated[originalIndex] + ", ";
                }
            }

            // Breakpoint here since this is just crappy debug code
        }
    }
}
